mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-07-04 09:29:28 +00:00
Fixed image editor panning behavior (overlap issue is still present)
This commit is contained in:
parent
21e5495202
commit
929e285f00
@ -105,6 +105,10 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
public void redraw() {
|
||||
System.out.println("Redraw " + getPlatform().name());
|
||||
currentImage = getPlatform().imageRenderer.renderImage(currentImage, getImageData(), getWidth(), getHeight());
|
||||
fixPanArrows();
|
||||
}
|
||||
|
||||
public void fixPanArrows() {
|
||||
anchorPane.getChildren().get(1).setLayoutX((anchorPane.getWidth() - 30) / 2);
|
||||
anchorPane.getChildren().get(2).setLayoutY((anchorPane.getHeight() - 30) / 2);
|
||||
anchorPane.getChildren().get(3).setLayoutX((anchorPane.getWidth() - 30) / 2);
|
||||
@ -152,10 +156,11 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
|
||||
@Override
|
||||
public void scrollBy(int deltaX, int deltaY) {
|
||||
posX += deltaX * 10;
|
||||
posY += deltaY * 10;
|
||||
posX += deltaX * 20;
|
||||
posY += deltaY * 20;
|
||||
posX = Math.max(0, posX);
|
||||
posY = Math.max(0, posY);
|
||||
updatePanTranslation();
|
||||
redraw();
|
||||
}
|
||||
|
||||
@ -194,11 +199,15 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
// Scale the image and move it so the upper-left corner is still in the right place.
|
||||
screen.setScaleX(zoom);
|
||||
screen.setScaleY(zoom);
|
||||
screen.setTranslateX(getWidth()*7 * (zoom-1));
|
||||
screen.setTranslateY(getHeight() * (zoom-1));
|
||||
updatePanTranslation();
|
||||
redraw();
|
||||
}
|
||||
|
||||
public void updatePanTranslation() {
|
||||
screen.setTranslateX((posX - getWidth()*7) * (zoom-1));
|
||||
screen.setTranslateY((posY - getHeight()) * (zoom-1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent t) {
|
||||
if (performAction(t.isShiftDown() || t.isSecondaryButtonDown(), t.getEventType().equals(MouseEvent.MOUSE_RELEASED), (int) t.getX() / xScale, (int) t.getY() / yScale)) {
|
||||
|
Loading…
Reference in New Issue
Block a user