mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Improve scroll precision
This commit is contained in:
@@ -3689,5 +3689,25 @@
|
|||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>4</major>
|
||||||
|
<minor>21</minor>
|
||||||
|
<build>4</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2022-02-27 00:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Fixed the issue with stereo phono jack rendering issues when rotated</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Improved precision of zooming in and out when nothing is selected</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
|
|||||||
Binary file not shown.
@@ -37,13 +37,21 @@
|
|||||||
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
||||||
<content_rating type="oars-1.1"/>
|
<content_rating type="oars-1.1"/>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="4.21.3" date="2022-02-22">
|
||||||
|
<description>
|
||||||
|
<ul>
|
||||||
|
<li>[Bug Fix] Fixed the issue with the app going back to .diylc user directory for configuration storage. Only diylc directory is used going forward, please copy config.xml from .diylc to diylc if you are missing any configuration</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.21.3</url>
|
||||||
|
</release>
|
||||||
<release version="4.21.2" date="2022-02-21">
|
<release version="4.21.2" date="2022-02-21">
|
||||||
<description>
|
<description>
|
||||||
<ul>
|
<ul>
|
||||||
<li>[Bug Fix] Fixed broken Linux app package</li>
|
<li>[Bug Fix] Fixed broken Linux app package</li>
|
||||||
</ul>
|
</ul>
|
||||||
</description>
|
</description>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.21.1</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.21.2</url>
|
||||||
</release>
|
</release>
|
||||||
<release version="4.21.1" date="2022-02-19">
|
<release version="4.21.1" date="2022-02-19">
|
||||||
<description>
|
<description>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -469,7 +469,10 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void zoom(int direction) {
|
public void zoom(int direction) {
|
||||||
Point mousePos = canvasPanel.getMousePosition(true);
|
Point mousePosBefore = canvasPanel.getMousePosition(true);
|
||||||
|
Point locationBefore = canvasPanel.getLocation();
|
||||||
|
int relativeX = (int) (mousePosBefore.getX() + locationBefore.getX());
|
||||||
|
int relativeY = (int) (mousePosBefore.getY() + locationBefore.getY());
|
||||||
|
|
||||||
// change zoom level
|
// change zoom level
|
||||||
double oldZoom = plugInPort.getZoomLevel();
|
double oldZoom = plugInPort.getZoomLevel();
|
||||||
@@ -495,24 +498,25 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
JScrollBar horizontal = scrollPane.getHorizontalScrollBar();
|
JScrollBar horizontal = scrollPane.getHorizontalScrollBar();
|
||||||
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
||||||
|
|
||||||
if (mousePos == null)
|
if (mousePosBefore == null) {
|
||||||
mousePos = new Point((int)visibleRect.getCenterX(), (int)visibleRect.getCenterY());
|
mousePosBefore = new Point((int)visibleRect.getCenterX(), (int)visibleRect.getCenterY());
|
||||||
|
|
||||||
if (selectionBounds == null) {
|
|
||||||
// center to cursor
|
|
||||||
Point desiredPos = new Point((int) (1d * mousePos.x / oldZoom * newZoom),
|
|
||||||
(int) (1d * mousePos.y / oldZoom * newZoom));
|
|
||||||
int dx = desiredPos.x - mousePos.x;
|
|
||||||
int dy = desiredPos.y - mousePos.y;
|
|
||||||
horizontal.setValue(horizontal.getValue() + dx);
|
|
||||||
vertical.setValue(vertical.getValue() + dy);
|
|
||||||
} else {
|
|
||||||
// center to selection
|
|
||||||
horizontal.setValue((int) (selectionBounds.getX() + selectionBounds.getWidth() / 2
|
|
||||||
- visibleRect.getWidth() / 2));
|
|
||||||
vertical.setValue((int) (selectionBounds.getY() + selectionBounds.getHeight() / 2
|
|
||||||
- visibleRect.getHeight() / 2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectionBounds == null) {
|
||||||
|
// center to cursor
|
||||||
|
Point desiredPos = new Point((int) (1d * mousePosBefore.getX() / oldZoom * newZoom),
|
||||||
|
(int) (1d * mousePosBefore.getY() / oldZoom * newZoom));
|
||||||
|
int newHorizontalPos = (int) (desiredPos.getX() - relativeX);
|
||||||
|
int newVerticalPos = (int) (desiredPos.getY() - relativeY);
|
||||||
|
horizontal.setValue(newHorizontalPos < 0 ? 0 : newHorizontalPos);
|
||||||
|
vertical.setValue(newVerticalPos < 0 ? 0 : newVerticalPos);
|
||||||
|
} else {
|
||||||
|
// center to selection
|
||||||
|
horizontal
|
||||||
|
.setValue((int) (selectionBounds.getX() + selectionBounds.getWidth() / 2 - visibleRect.getWidth() / 2));
|
||||||
|
vertical.setValue(
|
||||||
|
(int) (selectionBounds.getY() + selectionBounds.getHeight() / 2 - visibleRect.getHeight() / 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPopupAt(int x, int y) {
|
private void showPopupAt(int x, int y) {
|
||||||
|
|||||||
Reference in New Issue
Block a user