From 56f637b5e2debde8d96fafb34d9f1f571dd39208 Mon Sep 17 00:00:00 2001 From: bancika Date: Thu, 9 Apr 2020 12:10:39 +0200 Subject: [PATCH] Faster auto-scroll while dragging a component outside the visible portion of the canvas --- diylc/diylc-core/src/org/diylc/presenter/update.xml | 4 ++++ .../src/org/diylc/swing/plugins/canvas/CanvasPanel.java | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml index af52acbc..4e8e5f8d 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/update.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml @@ -2906,6 +2906,10 @@ IMPROVEMENT Improved performance of "Highlight Connected Areas" feature + + IMPROVEMENT + Faster auto-scroll while dragging a component outside the visible portion of the canvas + BUG_FIX Older files that contain "Open Jack 1/4" components sometimes open with the jacks rotated the wrong way diff --git a/diylc/diylc-swing/src/org/diylc/swing/plugins/canvas/CanvasPanel.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/canvas/CanvasPanel.java index 3598ab09..7175a880 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/plugins/canvas/CanvasPanel.java +++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/canvas/CanvasPanel.java @@ -324,17 +324,19 @@ public class CanvasPanel extends JComponent implements Autoscroll { // }); } - // Autoscroll + // Autoscroll + + private int autoScrollSize = 100; @Override public void autoscroll(Point cursorLocn) { - scrollRectToVisible(new Rectangle(cursorLocn.x - 15, cursorLocn.y - 15, 30, 30)); + scrollRectToVisible(new Rectangle(cursorLocn.x - autoScrollSize, cursorLocn.y - autoScrollSize, autoScrollSize * 2, autoScrollSize * 2)); } @Override public Insets getAutoscrollInsets() { Rectangle rect = getVisibleRect(); - return new Insets(rect.y - 15, rect.x - 15, rect.y + rect.height + 15, rect.x + rect.width + 15); + return new Insets(rect.y - autoScrollSize, rect.x - autoScrollSize, rect.y + rect.height + autoScrollSize, rect.x + rect.width + autoScrollSize); } public void setUseHardwareAcceleration(boolean useHardwareAcceleration) {