Faster auto-scroll while dragging a component outside the visible

portion of the canvas
This commit is contained in:
bancika
2020-04-09 12:10:39 +02:00
parent ae1aa7bde6
commit 56f637b5e2
2 changed files with 9 additions and 3 deletions
@@ -2906,6 +2906,10 @@
<changeType>IMPROVEMENT</changeType>
<description>Improved performance of "Highlight Connected Areas" feature</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Faster auto-scroll while dragging a component outside the visible portion of the canvas</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Older files that contain "Open Jack 1/4" components sometimes open with the jacks rotated the wrong way</description>
@@ -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) {