public void onMouseWheel(MouseWheelEvent e) { e.preventDefault(); // once we start zooming, don't allow other uses of mouse wheel for a while // so we don't accidentally edit a resistor value while zooming boolean zoomOnly = System.currentTimeMillis() < zoomTime+1000; if (!zoomOnly) scrollValues(e.getNativeEvent().getClientX(), e.getNativeEvent().getClientY(), e.getDeltaY()); if (mouseElm instanceof MouseWheelHandler && !zoomOnly) ((MouseWheelHandler) mouseElm).onMouseWheel(e); else if (scopeSelected != -1) scopes[scopeSelected].onMouseWheel(e); else if (!dialogIsShowing()) { zoomCircuit(e.getDeltaY()); zoomTime = System.currentTimeMillis(); } }
public VImageViewer() { /* Create widget's root panel */ panelRoot = new FlowPanel(); Style style = panelRoot.getElement().getStyle(); style.setPosition(Position.RELATIVE); setStyleName(CLASSNAME); panelRoot.setStyleName(CLASSNAME + "-flow"); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); /* Create image container */ imageContainer = new FlowPanel(); style = imageContainer.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setOverflow(Overflow.HIDDEN); /* Add widgets */ setWidget(panelRoot); panelRoot.add(imageContainer); /* Register handlers */ addDomHandler(this, KeyDownEvent.getType()); addDomHandler(this, ClickEvent.getType()); addMouseWheelHandler(new MouseWheelHandler() { public void onMouseWheel(MouseWheelEvent event) { event.preventDefault(); if (event.isNorth()) { moveImages(true); } else { moveImages(false); } } }); }
@Test public void testSetupContextSwitcher() { final AbsolutePanel domElementContainer = mock(AbsolutePanel.class); final LienzoPanel lienzoPanel = mock(LienzoPanel.class); final MouseWheelHandler wheelHandler = mock(MouseWheelHandler.class); final MouseMoveHandler moveHandler = mock(MouseMoveHandler.class); doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer(); doReturn(wheelHandler).when(gridLienzoScrollHandler).disablePointerEvents(); doReturn(moveHandler).when(gridLienzoScrollHandler).enablePointerEvents(); gridLienzoScrollHandler.setupContextSwitcher(); verify(domElementContainer).addDomHandler(wheelHandler, MouseWheelEvent.getType()); verify(gridLienzoPanel).addMouseMoveHandler(moveHandler); }
public void setMouseWheelMoved(JavaScriptObject aValue) { if (mouseWheelMoved != aValue) { if (mouseWheelReg != null) { mouseWheelReg.removeHandler(); mouseWheelReg = null; } mouseWheelMoved = aValue; if (mouseWheelMoved != null) { MouseWheelHandler handler = new MouseWheelHandler() { @Override public void onMouseWheel(MouseWheelEvent event) { if (mouseWheelMoved != null) { event.stopPropagation(); executeEvent(mouseWheelMoved, EventsPublisher.publish(event)); } } }; if (component instanceof Widget) { mouseWheelReg = ((Widget) component).addDomHandler(handler, MouseWheelEvent.getType()); } else if (component instanceof HasMouseWheelHandlers) { mouseWheelReg = ((HasMouseWheelHandlers) component).addMouseWheelHandler(handler); } } } }
@Override public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return this.addDomHandler(handler, MouseWheelEvent.getType()); }
public GreenScrollPanel(boolean withHorizontalScroll) { mainPanel = new ResizeLayoutPanel() { @Override protected void onAttach() { super.onAttach(); // hack to hide scrollbar in chrome when leaflet map is also // displayed (check GreenScrollImpl.onAttach too) if (isChrome()) { try { ((Element) (getElement().getChild(1))).getStyle().setZIndex(-1000); ((Element) (getElement().getChild(2))).getStyle().setZIndex(-1000); } catch (Exception e) { GWT.log("", e); } } } }; if (hasMacNanoScrollBar()) { this.impl = new ScrollPanel(); } else { this.impl = new GreenScrollImpl(withHorizontalScroll); } mainPanel.setWidget(impl); impl.addDomHandler(new MouseWheelHandler() { @Override public void onMouseWheel(MouseWheelEvent event) { event.stopPropagation(); } }, MouseWheelEvent.getType()); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { eventHandlers.put(handler, (DomEvent.Type) MouseWheelEvent.getType()); if (canvas != null) { canvas.addDomHandler(handler, MouseWheelEvent.getType()); } return null; }
@Override public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return addDomHandler(handler, MouseWheelEvent.getType()); }
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return widget.addMouseWheelHandler(handler); }
private MouseWheelHandler destroyDOMElements() { return (event) -> gridLayer .getGridWidgets() .forEach(gridWidget -> gridWidget .getModel() .getColumns() .stream() .filter(gridColumn -> gridColumn instanceof HasDOMElementResources) .map(gridColumn -> ((HasDOMElementResources) gridColumn)) .forEach(HasDOMElementResources::destroyResources)); }
@Override public HandlerRegistration addMouseWheelHandler( MouseWheelHandler handler) { return addHandler(handler, MouseWheelEvent.getType()); }
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return addDomHandler(handler, MouseWheelEvent.getType()); }
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return html.addMouseWheelHandler(handler); }
@Override public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) { return this.addDomHandler(handler, MouseWheelEvent.getType()); }
@Override public HandlerRegistration addMouseWheelHandler(MouseWheelHandler p_handler) { return m_intBox.addMouseWheelHandler( p_handler ); }
MouseWheelHandler disablePointerEvents() { return event -> gridLienzoScrollUI().disablePointerEvents(getDomElementContainer()); }
@Override public com.google.gwt.event.shared.HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return this.addDomHandler(handler, MouseWheelEvent.getType()); }
@Override public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return addMouseWheelHandler(handler); }
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return eventWidget.addMouseWheelHandler(handler); }
@Override public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) { return addDomHandler(handler, MouseWheelEvent.getType()); }
@Override public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return addDomHandler(handler, com.google.gwt.event.dom.client.MouseWheelEvent.getType()); }
/** * Set a new mouse wheel controller on the map. If the zoom on scroll is currently enabled, it will be disabled * first. * * @param controller * The new mouse wheel controller to be applied on the map. * @since 1.6.0 */ @Api public void setMouseWheelController(MouseWheelHandler controller) { setZoomOnScrollEnabled(false); mouseWheelRegistration = graphics.addMouseWheelHandler(controller); }