@Override public void mouseDragged(MouseEvent e) { if (resizing) { config.width = widthStart + (resizeStart - e.getXOnScreen()); if (config.width < 1) { config.width = 1; } configService.dispatch().configChanged(); } if (dragging) { // Disable animation when dragging for better experience. editor.getScrollingModel().disableAnimation(); editor .getScrollingModel() .scrollVertically( scrollStart + coords.pixelsToLines(e.getY() - mouseStart) * editor.getLineHeight()); editor.getScrollingModel().enableAnimation(); } }
void forwardEventToParent(MouseEvent e) { getParent() .dispatchEvent( new MouseEvent( getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON)); }
@Override public void mousePressed(MouseEvent e) { if (!dragging && inResizeGutter(e.getX())) { resizing = true; } else if (!resizing) { dragging = true; } if (resizing) { resizeStart = e.getXOnScreen(); widthStart = config.width; } if (dragging) { Rectangle visibleArea = editor.getScrollingModel().getVisibleArea(); int firstVisibleLine = getMapYFromEditorY((int) visibleArea.getMinY()); int height = coords.linesToPixels( (int) ((visibleArea.getMaxY() - visibleArea.getMinY()) / editor.getLineHeight())); int panelY = e.getY() - getY(); if (config.jumpOnMouseDown && (panelY <= firstVisibleLine || panelY >= (firstVisibleLine + height))) { editor.getScrollingModel().disableAnimation(); editor .getScrollingModel() .scrollTo( editor.offsetToLogicalPosition( coords.screenSpaceToOffset(e.getY(), config.percentageBasedClick)), ScrollType.CENTER); editor.getScrollingModel().enableAnimation(); } scrollStart = editor.getScrollingModel().getVerticalScrollOffset(); mouseStart = e.getY(); } }