public void mouseWheelMoved(MouseWheelEvent e) { Event.EventType type = ScrollEvent.ScrollVertical; Node node = findTopNode(e.getX(), e.getY()); int rotation = e.getWheelRotation(); if (e.isShiftDown()) { type = ScrollEvent.ScrollHorizontal; } EventBus.getSystem().publish(new ScrollEvent(type, node, rotation)); }
private static boolean isHorizontalScrolling(Component c, MouseEvent e) { if (c != null && e instanceof MouseWheelEvent && (!SystemInfo.isMac || isDiagramViewComponent(c.getParent()))) { final MouseWheelEvent mwe = (MouseWheelEvent) e; return mwe.isShiftDown() && mwe.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL && findHorizontalScrollBar(c) != null; } return false; }
public void mouseWheelMoved(MouseWheelEvent e) { if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { dragX = e.getX(); dragY = e.getY(); if (e.isShiftDown()) { tmpDragX = dragX - e.getUnitsToScroll(); tmpDragY = dragY; } else { tmpDragX = dragX; tmpDragY = dragY - e.getUnitsToScroll(); } movingMap(tmpDragX, tmpDragY); } }
/** * Determines the value of the z-section. * * @see MouseWheelListener#mouseWheelMoved(MouseWheelEvent) */ public void mouseWheelMoved(MouseWheelEvent e) { if (model.isBigImage()) return; if (e.isAltDown() || e.isShiftDown() || e.isControlDown()) { // zooming if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { int v = e.getWheelRotation(); model.zoom(v < 0); // zoom in and out. } return; } // change the z-section. int maxZ = model.getMaxZ(); int maxT = model.getMaxT(); if (maxZ <= 0 && maxT <= 0) return; boolean up = true; if (e.getWheelRotation() > 0) up = false; if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { int v = model.getDefaultZ() - e.getWheelRotation(); if (up) { if (v <= maxZ) { model.setSelectedXYPlane(v, -1); if (canvas instanceof BrowserBICanvas) ((BrowserBICanvas) canvas).setPaintedString(v, model.getDefaultT()); } else { if (canvas instanceof BrowserBICanvas) ((BrowserBICanvas) canvas).setPaintedString(-1, -1); } } else { // moving down if (v >= 0) { model.setSelectedXYPlane(v, -1); if (canvas instanceof BrowserBICanvas) ((BrowserBICanvas) canvas).setPaintedString(v, model.getDefaultT()); } else { if (canvas instanceof BrowserBICanvas) ((BrowserBICanvas) canvas).setPaintedString(-1, -1); } } } }