/** * @see MouseEvent */ public boolean isShiftDown () { return event.isShiftDown (); }
/** * @see MouseEvent */ public boolean isShiftDown () { return event.isShiftDown (); }
@Override public void mouseWheelMoved(MouseWheelEvent e) { int n = e.getWheelRotation(); if(e.isShiftDown()) //we've scrolled n times horizontally else //we've scrolled n times vertically. }
public void mouseWheelMoved(MouseWheelEvent e) { if (e.getWheelRotation() != 0) { if (e.isShiftDown()) { int direction = e.getWheelRotation() < 0 ? -1 : 1; if (e.getSource().equals(internalTimelineViewport)) { // int i = horizontalScrollBar.getValue(); // Rectangle viewRect = // internalTimelineViewport.getViewRect(); // int dx = e.getPoint().x - (viewRect.x + // viewRect.width / 2); // // DayDate dayDate = dayDateAtPoint(e.getPoint()); zoomTimeline(direction * 20); // // int x = pointAtDayDate(dayDate); // int j = e.getPoint().x - x; // // horizontalScrollBar.setValue(i+j*2); } else { zoomTimeline(direction * 20); } } else { int direction = e.getWheelRotation() < 0 ? -1 : 1; moveSelection(0, direction); } } } }
public void mouseWheelMoved(MouseWheelEvent e) { if (e.getWheelRotation() != 0) { if (e.isShiftDown()) { int direction = e.getWheelRotation() < 0 ? -1 : 1; if (e.getSource().equals(internalTimelineViewport)) { // int i = horizontalScrollBar.getValue(); // Rectangle viewRect = // internalTimelineViewport.getViewRect(); // int dx = e.getPoint().x - (viewRect.x + // viewRect.width / 2); // // DayDate dayDate = dayDateAtPoint(e.getPoint()); zoomTimeline(direction * 20); // // int x = pointAtDayDate(dayDate); // int j = e.getPoint().x - x; // // horizontalScrollBar.setValue(i+j*2); } else { zoomTimeline(direction * 20); } } else { int direction = e.getWheelRotation() < 0 ? -1 : 1; moveSelection(0, direction); } } } }
public void mouseWheelMoved(final MouseWheelEvent _e) { if (_e.isControlDown()) { rotateY(_e.getWheelRotation() < 0 ? -getRotateAngle() : getRotateAngle()); } else if (_e.isShiftDown()) { translateX(_e.getWheelRotation() < 0 ? -2 : 2); } else { translateY(_e.getWheelRotation() < 0 ? -2 : 2); } }
public void mouseWheelMoved(MouseWheelEvent event) { double u = event.getWheelRotation(); //double u = event.getPreciseWheelRotation(); // JDK 1.7 only Tile tile = (Tile)event.getSource(); DRectangle vr = tile.getViewRectangle(); if (event.isShiftDown() && vr.width<1.0) { // horizontal HScrollBar hsb = _hsb[tile.getColumnIndex()]; vr.x += u*hsb.getUnitIncrement(1)*SCROLL_SCL; vr.x = max(0.0,min(1.0-vr.width,vr.x)); tile.setViewRectangle(vr); } else if (!event.isShiftDown() && vr.height<1.0) { // vertical VScrollBar vsb = _vsb[tile.getRowIndex()]; vr.y += u*vsb.getUnitIncrement(1)*SCROLL_SCL; vr.y = max(0.0,min(1.0-vr.height,vr.y)); tile.setViewRectangle(vr); } } });
public void mouseWheelMoved(final MouseWheelEvent e) { try { if (e.isShiftDown()) { if (e.getWheelRotation() > 0) stepslice(false); else if (e.getWheelRotation() < 0) stepslice(true); if (Toolbar.getToolId() == Toolbar.POINT && mode == MOVE) moveobject(); } else if (e.isControlDown()) { if (e.getWheelRotation() > 0) stepchannel(false); else if (e.getWheelRotation() < 0) stepchannel(true); } else { if (e.getWheelRotation() > 0) steptime(false); else if (e.getWheelRotation() < 0) steptime(true); } } catch (Throwable x) { mtrackj.catcher().uncaughtException(Thread.currentThread(),x); } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isShiftDown()) { return; } Viewport viewport = layerCanvas.getViewport(); int wheelRotation = e.getWheelRotation(); double oldZoomFactor = viewport.getZoomFactor(); double newZoomFactor = oldZoomFactor * Math.pow(1.1, wheelRotation); viewport.setZoomFactor(newZoomFactor); }
public void mouseWheelMoved(MouseWheelEvent e) { if (e.isShiftDown()) { zoomTimeline(-e.getScrollAmount() * e.getWheelRotation()); } else { if (timeline.getParent() != null) { timeline.getParent().dispatchEvent( SwingUtilities.convertMouseEvent(timeline, e, timeline.getParent())); } } } }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isShiftDown()) { return; } Viewport viewport = layerCanvas.getViewport(); int wheelRotation = e.getWheelRotation(); if (invertZooming) { wheelRotation *= -1; } double oldZoomFactor = viewport.getZoomFactor(); double newZoomFactor = oldZoomFactor * Math.pow(1.1, wheelRotation); viewport.setZoomFactor(newZoomFactor); }
public void mouseWheelMoved(final MouseWheelEvent _e) { if (_e.isConsumed()) { return; } if (_e.isControlDown()) { if (_e.getWheelRotation() > 0) { target_.zoomOut(); } else { target_.zoomIn(); } } else { if (_e.getWheelRotation() < 0) { if (_e.isShiftDown()) { target_.translateXRight(false, false); } else { target_.translateYUp(false, false); } } else if (_e.isShiftDown()) { target_.translateXLeft(false, false); } else { target_.translateYDown(false, false); } } } }
public void mouseWheelMoved(MouseWheelEvent e) { /**************************************************** * move caret depending on pressed control-keys: - Alt: move cursor, * do not select - Alt+(shift or control): move cursor, select - * shift: scroll page - control: scroll single line - <else>: scroll * 3 lines ****************************************************/ if (e.isAltDown()) { boolean select = e.isShiftDown() || e.isControlDown(); if (e.getWheelRotation() < 0) goToPrevLine(select); else goToNextLine(select); } else if (e.isShiftDown()) { if (e.getWheelRotation() > 0) scrollDownPage(); else scrollUpPage(); } else if (e.isControlDown()) { setFirstLine(getFirstLine() + e.getWheelRotation()); } else if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { setFirstLine(getFirstLine() + e.getUnitsToScroll()); } else { setFirstLine(getFirstLine() + 3 * e.getWheelRotation()); } } } // }}}
@Override public void mouseWheelMoved( final MouseWheelEvent e ) { final ImagePlus lImp = getImagePlus( e ); final HyperStackDisplayer displayer = displayers.get( lImp ); if ( null == displayer ) return; final Spot editedSpot = editedSpots.get( lImp ); if ( null == editedSpot || !e.isAltDown() ) return; double radius = editedSpot.getFeature( Spot.RADIUS ); final double dx = lImp.getCalibration().pixelWidth; if ( e.isShiftDown() ) radius += e.getWheelRotation() * dx * COARSE_STEP; else radius += e.getWheelRotation() * dx * FINE_STEP; if ( radius < dx ) { e.consume(); return; } editedSpot.putFeature( Spot.RADIUS, radius ); displayer.imp.updateAndDraw(); e.consume(); updateStatusBar( editedSpot, lImp.getCalibration().getUnits() ); }
@Override public void mouseWheelMoved( final MouseWheelEvent e ) { final ImagePlus lImp = getImagePlus( e ); final HyperStackDisplayer displayer = displayers.get( lImp ); if ( null == displayer ) return; final Spot editedSpot = editedSpots.get( lImp ); if ( null == editedSpot || !e.isAltDown() ) return; double radius = editedSpot.getFeature( Spot.RADIUS ); final double dx = lImp.getCalibration().pixelWidth; if ( e.isShiftDown() ) radius += e.getWheelRotation() * dx * COARSE_STEP; else radius += e.getWheelRotation() * dx * FINE_STEP; if ( radius < dx ) { e.consume(); return; } editedSpot.putFeature( Spot.RADIUS, radius ); displayer.imp.updateAndDraw(); e.consume(); updateStatusBar( editedSpot, lImp.getCalibration().getUnits() ); }
@Override public void mouseWheelMoved(MouseWheelEvent e) { if(e.isShiftDown()){ return; } CoordinateScalar sc = myScalingManager.getScalar(); double scroll = e.getWheelRotation(); scroll = Math.pow(myScrollRate, scroll); scroll *= sc.getScaleX(); if(scroll >= CoordinateScalar.MAX_SCALE_AMOUNT || scroll <= CoordinateScalar.MIN_SCALE_AMOUNT){ return; } int cursorX = e.getX(); double val = sc.unscaleX(cursorX); double oldVal = myScrollPane.getHorizontalScrollBar().getValue(); if(((int)myPreviousScrollPosition) == oldVal){ oldVal = myPreviousScrollPosition; } double cursorWindowX = cursorX - oldVal; sc.setScaleX(scroll); double newKnobX = sc.scaleX(val) - cursorWindowX; myScalingManager.setFocusPosition((int)newKnobX, null); myPreviousScrollPosition = newKnobX; } }
/** * Control + Mousewheel moves channel (Ctrl as in Channel) Shift - Mousewheel * moves frame (shiFt as in Frame) */ @Override public void mouseWheelMoved(final MouseWheelEvent event) { if (event.isControlDown()) { synchronized (this) { int channel = i5d.getCurrentChannel() + event.getWheelRotation(); if (channel < 1) channel = 1; else if (channel > i5d.getNChannels()) channel = i5d.getNChannels(); i5d.setChannel(channel); } } else if (event.isShiftDown()) { synchronized (this) { int frame = i5d.getCurrentFrame() + event.getWheelRotation(); if (frame < 1) frame = 1; else if (frame > i5d.getNFrames()) frame = i5d.getNFrames(); i5d.setFrame(frame); } } else { super.mouseWheelMoved(event); } }
/** * @overrides CScrollPane.mouseWheelMoved * TODO: This is duplicate code (In Hover, Glass, and Tackless ScollPanes) * For MACs only: Horizontal scroll events are delivered * to JScrollPanes as Shift+ScrollWheel events AUTOMATICALLY, * since there is no horizontal scrolling API in Java. * Horizontal scrolling mouse events will now move the * content view horizontally, along with Shift key modifier events. * For WINDOWs: Manually press Shift while scrolling to scroll horizontally */ @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isShiftDown()) { scrollviewport.getHorizontalScrollBar().getModel().setValue( scrollviewport.getHorizontalScrollBar().getModel().getValue() + e.getUnitsToScroll() * e.getScrollAmount() * SCROLLINGUNIT); horizontalbar.repaint(); } else { scrollviewport.getVerticalScrollBar().getModel().setValue( scrollviewport.getVerticalScrollBar().getModel().getValue() + e.getUnitsToScroll() * e.getScrollAmount() * SCROLLINGUNIT); verticalbar.repaint(); } }
/** * @overrides CScrollPane.mouseWheelMoved * TODO: This is duplicate code (In Hover, Glass, and Tackless ScollPanes) * For MACs only: Horizontal scroll events are delivered * to JScrollPanes as Shift+ScrollWheel events AUTOMATICALLY, * since there is no horizontal scrolling API in Java. * Horizontal scrolling mouse events will now move the * content view horizontally, along with Shift key modifier events. * For WINDOWs: Manually press Shift while scrolling to scroll horizantally */ @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isShiftDown()) { scrollviewport.getHorizontalScrollBar().getModel().setValue( scrollviewport.getHorizontalScrollBar().getModel().getValue() + e.getUnitsToScroll() * e.getScrollAmount() * SCROLLINGUNIT); horizontalbar.repaint(); } else { scrollviewport.getVerticalScrollBar().getModel().setValue( scrollviewport.getVerticalScrollBar().getModel().getValue() + e.getUnitsToScroll() * e.getScrollAmount() * SCROLLINGUNIT); verticalbar.repaint(); } }
/** * @overrides CScrollPane.mouseWheelMoved * TODO: This is duplicate code (In Hover, Glass, and Tackless ScollPanes) * For MACs only: Horizontal scroll events are delivered * to JScrollPanes as Shift+ScrollWheel events AUTOMATICALLY, * since there is no horizontal scrolling API in Java. * Horizontal scrolling mouse events will now move the * content view horizontally, along with Shift key modifier events. * For WINDOWs: Manually press Shift while scrolling to scroll horizantally */ @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isShiftDown()) { scrollviewport.getHorizontalScrollBar().getModel().setValue( scrollviewport.getHorizontalScrollBar().getModel().getValue() + e.getUnitsToScroll() * e.getScrollAmount() * SCROLLINGUNIT); horizontalbar.repaint(); } else { scrollviewport.getVerticalScrollBar().getModel().setValue( scrollviewport.getVerticalScrollBar().getModel().getValue() + e.getUnitsToScroll() * e.getScrollAmount() * SCROLLINGUNIT); verticalbar.repaint(); } }