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
.
See issue
808337.TabSet
tab at certain zoom levels. See
issues
808838 and
814033.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."); } } }); } }