Changeset 633


Ignore:
Timestamp:
12/17/13 16:23:33 (10 years ago)
Author:
jts21
Message:

Fix accidentally following links while panning, and make panning only start after moving the cursor 5 pixels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r632 r633  
    250250                }
    251251               
    252                 // update panning position values so position doesn't jump
    253                 lastX = e.getX();
    254                 lastY = e.getY();
     252                if(ExperimentalFeatures.MousePan) {
     253                // don't pan if we're not over the frame
     254                _overFrame = FrameUtils.getCurrentItem() == null;
     255                _isPanOp = false;
     256                // update panning position values so position doesn't jump
     257                panStartX = e.getX();
     258                panStartY = e.getY();
     259                MouseX = panStartX;
     260                MouseY = panStartY;
     261                }
    255262
    256263                // System.out.println(modifiersEx);
     
    493500
    494501                // Only a no op if user releases in free space!
    495                 if (_isNoOp && (releasedOn == null && releasedIn == null)) {
     502                if (_isPanOp || (_isNoOp && (releasedOn == null && releasedIn == null))) {
    496503                        if (_isDelete) {
    497504                                _isDelete = false;
     
    513520                        }
    514521
    515                         MessageBay
    516                                         .displayMessage("Action cancelled, mouse moved more than "
     522                        if(!_isPanOp) {
     523                                MessageBay.displayMessage("Action cancelled, mouse moved more than "
    517524                                                        + UserSettings.NoOpThreshold + " pixels.");
     525                        }
    518526                        FrameGraphics.Repaint();
    519527                        return;
     
    16501658        }
    16511659
    1652         private int lastX, lastY;
     1660        private boolean _overFrame;
     1661        private int panStartX, panStartY;
     1662        private boolean _isPanOp;
    16531663        public void mouseDragged(MouseEvent e) {
    16541664                _lastMouseDragged = e;
     
    16761686               
    16771687                // panning the frame when dragging the mouse while shift-leftclicking
    1678                 if(ExperimentalFeatures.MousePan && e.isShiftDown() && (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
    1679                         int dX = (int) (e.getX() - lastX);
    1680                         int dY = (int) (e.getY() - lastY);
     1688                if(ExperimentalFeatures.MousePan && _overFrame && e.isShiftDown() &&
     1689                                (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0 &&
     1690                                (_isPanOp || (Math.max(Math.abs(panStartX - e.getX()), Math.abs(panStartY - e.getY())) > 5))) {
     1691                        int dX = (int) (e.getX() - MouseX);
     1692                        int dY = (int) (e.getY() - MouseY);
    16811693                        Misc.pan(DisplayIO.getCurrentFrame(), dX, dY);
    1682                 }
    1683                 lastX = e.getX();
    1684                 lastY = e.getY();
     1694                        MouseX = e.getX();
     1695                        MouseY = e.getY();
     1696                        _isPanOp = true;
     1697                }
    16851698
    16861699                // check if user is dragging across a text item
Note: See TracChangeset for help on using the changeset viewer.