List of usage examples for com.google.gwt.event.dom.client MouseWheelEvent isNorth
public boolean isNorth()
true if #getDeltaY() is a negative value (ie, the velocity is directed toward the top of the screen). From source file:at.ait.dme.yuma.client.image.StandardImageComposite.java
License:EUPL
/** * constructs a new image composite for the provided image url. * /*from w w w. java 2 s.c o m*/ * @param imageUrl */ public StandardImageComposite(String imageUrl) { // set up the image and the image panel this.imageUrl = imageUrl; image = new Image(imageUrl); image.addMouseWheelHandler(new MouseWheelHandler() { public void onMouseWheel(MouseWheelEvent event) { zoom(event.isNorth()); } }); // in case the image is cached the load listener will never be called // so we have to call it manually. we can determine if the image is cached // by checking height or width > 0. // see also http://code.google.com/p/google-web-toolkit/issues/detail?id=2149 if (image.getHeight() > 0) { imageLoadListener.onLoad(null); } else { loadListenerRegistration = image.addLoadHandler(imageLoadListener); errorListenerRegistration = image.addErrorHandler(imageErrorListener); } // initialize the widget imagePanel.add(image); initWidget(imagePanel); }
From source file:at.ait.dme.yuma.suite.apps.image.client.ImageViewer.java
License:EUPL
/** * constructs a new image composite for the provided image url. * /*from www . j a v a2s. c o m*/ * @param imageUrl */ public ImageViewer(String imageUrl) { // set up the image and the image panel image = new Image(imageUrl); image.addMouseWheelHandler(new MouseWheelHandler() { public void onMouseWheel(MouseWheelEvent event) { zoom(event.isNorth()); } }); // in case the image is cached the load listener will never be called // so we have to call it manually. we can determine if the image is cached // by checking height or width > 0. // see also http://code.google.com/p/google-web-toolkit/issues/detail?id=2149 if (image.getHeight() > 0) { imageLoadListener.onLoad(null); } else { loadListenerRegistration = image.addLoadHandler(imageLoadListener); errorListenerRegistration = image.addErrorHandler(imageErrorListener); } // initialize the widget imagePanel.add(image); initWidget(imagePanel); }
From source file:edu.udes.bio.genus.client.ui.canvas.DrawerMouseWheelHandler.java
License:Open Source License
@Override public void onMouseWheel(MouseWheelEvent event) { if (this.dl.isHolding() == true && this.dl.rna != null) { if (event.isSouth()) { this.dl.rna.rotate((float) 10.0); } else if (event.isNorth()) { this.dl.rna.rotate((float) -10.0); }// ww w .java 2s .co m } else { if (event.isSouth()) { ZoomUtil.doZoom(this.dr, ZoomUtil.zoomAction.zoomOut); } else if (event.isNorth()) { ZoomUtil.doZoom(this.dr, ZoomUtil.zoomAction.zoomIn); } } }
From source file:org.geomajas.gwt2.client.controller.NavigationController.java
License:Open Source License
@Override public void onMouseWheel(MouseWheelEvent event) { final boolean isNorth; if (event.getDeltaY() == 0) { isNorth = (getWheelDelta(event.getNativeEvent()) < 0); } else {//from www .j av a 2s .com isNorth = event.isNorth(); } Coordinate location = getLocation(event, RenderSpace.WORLD); scrollZoomTo(isNorth, location); }
From source file:org.geomajas.gwt2.plugin.graphicsediting.example.client.annotation.IntervalNavigationController.java
License:Open Source License
@Override public void onMouseWheel(MouseWheelEvent event) { final boolean isNorth; if (event.getDeltaY() == 0) { isNorth = (getWheelDelta(event.getNativeEvent()) < 0); } else {//from w ww . j av a 2 s . c om isNorth = event.isNorth(); } final Coordinate location = getLocation(event, RenderSpace.WORLD); if (intervalTimer != null) { intervalTimer.cancel(); } intervalTimer = new Timer() { @Override public void run() { scrollZoomTo(isNorth, location); } }; intervalTimer.schedule(intervalMillis); }
From source file:org.n52.client.sos.ctrl.MouseWheelControl.java
License:Open Source License
/** * Computes the new domain bounds/*from w w w . j a v a 2 s .c om*/ */ private Bounds changeDomainBounds(MouseWheelEvent mouseWheelEvent) { Bounds setBounds = this.currentSetDomainBoundsEvent.getBounds(); // memorizing the domain point at the current mouse position Point originalDomainPoint = computeDomainPointAtMousePosition(mouseWheelEvent, setBounds); // zoom in or zoom out at the center if (mouseWheelEvent.isNorth()) { setBounds = this.currentSetDomainBoundsEvent.getBounds() .transformProportional(createZoomInBounds(computeDelta(mouseWheelEvent))); } else { setBounds = this.currentSetDomainBoundsEvent.getBounds() .transformProportional(createZoomOutBounds(computeDelta(mouseWheelEvent))); } // figuring out the new domain point at the mouse position Point newDomainPoint = computeDomainPointAtMousePosition(mouseWheelEvent, setBounds); // shifting the originalDomainPoint back to the mouse position setBounds = setBounds.shiftAbsolute(originalDomainPoint.getX() - newDomainPoint.getX(), originalDomainPoint.getY() - newDomainPoint.getY()); if (this.currentMaxDomainBoundsEvent == null || (this.currentMaxDomainBoundsEvent.containsHorizontally(setBounds.getLeft(), setBounds.getRight()) && this.currentMaxDomainBoundsEvent.containsVertically(setBounds.getTop(), setBounds.getBottom()))) { return setBounds; } else { return null; } }
From source file:org.n52.client.sos.ctrl.MouseWheelControl.java
License:Open Source License
/** * Computes the new bounds of the image for the preview *//*from w ww .j a v a 2 s . c o m*/ private Bounds changeImageBounds(MouseWheelEvent mouseWheelEvent) { // memorizing current mouse position Point mousePos = new Point(mouseWheelEvent.getX() - getViewportBounds().getLeft(), mouseWheelEvent.getY() - getViewportBounds().getTop()); // zoom in or zoom out at the center (the inverse of changeSetBounds) Bounds newImageBounds; if (mouseWheelEvent.isNorth()) { newImageBounds = getViewportDataAreaBounds() .transformProportional(createZoomOutBounds(computeDelta(mouseWheelEvent))); } else { newImageBounds = getViewportDataAreaBounds() .transformProportional(createZoomInBounds(computeDelta(mouseWheelEvent))); } // translating it back to the viewport size newImageBounds = newImageBounds.transform(getViewportDataAreaBounds(), getViewportBounds()); // new pixel position at mouse coordinates Point relPoint = new Point( (mouseWheelEvent.getX() - getViewportBounds().getLeft()) / getViewportBounds().getWidth(), (mouseWheelEvent.getY() - getViewportBounds().getTop()) / getViewportBounds().getHeight()); Point newMousePos = newImageBounds.findAbsolutePoint(relPoint); // shifting the mousePos back to the mouse position newImageBounds = newImageBounds.shiftAbsolute(mousePos.getX() - newMousePos.getX(), mousePos.getY() - newMousePos.getY()); return newImageBounds; }
From source file:org.openelis.gwt.widget.MenuPanel.java
License:Open Source License
public void onMouseWheel(MouseWheelEvent event) { if (event.isSouth() && down.getStyleName().indexOf("MenuDisabled") == -1) { if (ap.getWidgetTop(panel) <= ap.getOffsetHeight() - panel.getOffsetHeight()) { down.addStyleName("MenuDisabled"); } else {// ww w . jav a 2s . c o m ap.setWidgetPosition(panel, 0, ap.getWidgetTop(panel) - 10); up.removeStyleName("MenuDisabled"); } } if (event.isNorth() && up.getStyleName().indexOf("MenuDisabled") == -1) { if (ap.getWidgetTop(panel) >= 0) { up.addStyleName("MenuDisabled"); } else { ap.setWidgetPosition(panel, 0, ap.getWidgetTop(panel) + 10); down.removeStyleName("MenuDisabled"); } } }
From source file:org.peergreen.vaadin.diagram.client.handler.DiagramClientMouseWheelHandler.java
License:Apache License
@Override public void onMouseWheel(MouseWheelEvent event) { if (event.isNorth()) { getConnector().doZoomOut();/* ww w . j av a2 s .c o m*/ } else if (event.isSouth()) { getConnector().doZoomIn(); } }
From source file:org.vaadin.addon.itemlayout.widgetset.client.list.AbstractListLayoutConnector.java
License:Open Source License
/** * Add mousewheel listener to visible elements list layout *///from w ww.j a v a2 s .c o m private void addMouseWheelListener() { getElemVisibleListLayout().addMouseWheelHandler(new MouseWheelHandler() { @Override public void onMouseWheel(final MouseWheelEvent event) { event.preventDefault(); // Wheel UP if (event.isNorth()) { scrollPrevEvent(); } // Wheel DOWN else if (event.isSouth()) { scrollNextEvent(); } } }); }