public interface BrowserZoom
Support in this release is restricted to:
background-image
related CSS Working Group tests with page zoom,
causing background images to draw oddly in certain cases. See issues
412914 and
421331.EdgedCanvas
objects, which are
faint antialiasing artifacts
between the images used to make up the EdgedCanvas
. This affects
drop shadows
and showing edges with a
high Canvas.edgeSize
.TabSet
tab at certain zoom levels.background-position
and background image clipping used for spriting may
be misapplied. This can introduce visual effects where different parts of a sprite are
visible. See bug
45840.EdgedCanvas
,
allowing content below the EdgedCanvas
in stacking order to show through.
See bug
122061.TabSet
tab at certain zoom levels.Although the detect-zoom library does not accurately determine the current zoom level, the library can be used in Firefox to detect when the zoom level changes so that a warning message can be displayed to the user.
Note that the latest version of detect-zoom.min.js
that is committed to the GitHub
repository is out of date. It is not recommended to use this file because it causes a runtime
TypeError
if the script is included before the document body has been
created (see issue
#41).
To rebuild detect-zoom.min.js
, you will need to install git, npm, and GNU make.
Then at a terminal, run the following commands:
git clone https://github.com/tombigel/detect-zoom.git cd detect-zoom npm install touch detect-zoom.js && make
To use the detect-zoom library in your Smart GWT project:
detect-zoom.min.js
script.public
in the same directory as your GWT module.
For example, if your GWT module is located at com/mycompany/Product.gwt.xml
then create the com/mycompany/public
directory if it does not already exist.
Copy the rebuilt detect-zoom.min.js
script to this public
directory.<script src="detect-zoom.min.js"/>
public static native double detectZoom() /*-{ return $wnd.detectZoom.zoom(); }-*/;
EntryPoint
is called, call the detectZoom() static
method and save the return value. Then add a window resize handler
(see Window.addResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler))
that calls detectZoom() on resize, checking to see if a different value is returned.import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.user.client.Window; import com.smartgwt.client.util.SC; public class MyEntryPoint implements EntryPoint { public static native double detectZoom() /*-{ return $wnd.detectZoom.zoom(); }-*/; @Override public void onModuleLoad() { //... Window.addResizeHandler(new ResizeHandler() { private double lastZoom = detectZoom(); @Override public void onResize(ResizeEvent event) { final double newZoom = detectZoom(); if (newZoom != lastZoom) { lastZoom = newZoom; SC.warn("After changing the page zoom, you must refresh the page."); } } }); } }
To work around this issue, we rely the idea of a maximum zoom overflow error
, the
experimental maximum possible error due to subpixel
rendering when browser and/or OS-level zoom is present. This value is typically one or a
few pixels, but should always be kept as small as possible because it also represents the
maximum amount of unwanted clipping that the Framework might apply to the canvas when
overflow is present. If too large, it will easily be noticed and may clip the edges of
buttons or other content.
For example, if you execute the following sample in a zoomed desktop browser, you'll see
that if you try to grab the bottom edge and drag-resize it shorter, some text will be
clipped from the bottom before the scrollbar appears. This is because the
maximum zoom overflow error
for the sample is 25, a
much larger value than ever needed but illustrative of its potential for clipping content.
Canvas pane = new HTMLPane() .setWidth(230).setHeight(100) .setShowEdges(true) .setMaxZoomOverflowError(25).setCorrectZoomOverflow(true) .setCanDragResize(true).setDragResizeAppearance(DragAppearance.TARGET) .setContents("Here men from the planet Earth first set foot upon the Moon " + "July 1969, A.D. We came in peace for all mankind.");Note: the framework should set
Canvas.correctZoomOverflow
automatically
for you where it's needed, so it's set explicitly above to force it to an excessive value.
If you can still reproduce the flickering scrollbar problem with our canvas default settings for your browser and OS, please contact Isomorphic and provide as much detail about your setup as possible: framework version, skin in use, whether the skin is customized, browser, browser version, OS platform and version, and any non-default visual settings for the browser or OS.
body
to have hidden CSS
overflow via
something like:
<body style="overflow:hidden">The framework will log a warning if overflow hasn't been properly suppressed. To avoid it, you can set the window property
isc_allowViewportScrolling
true before
loading the framework files in your HTML.Page.getDevicePixelRatio()