Added logic to reset zoom of image editor when switching/creating images and also fixed blue rectangle showing in wrong place when drawing rectangles.

This commit is contained in:
Brendan Robert 2014-12-16 22:06:27 -06:00
parent e7aa88ab65
commit f6b38066c7
2 changed files with 8 additions and 6 deletions

View File

@ -253,8 +253,8 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
private void startSelection(int x, int y) {
selectRect = new Rectangle(1, 1, Color.NAVY);
selectRect.setTranslateX(x * xScale * zoom);
selectRect.setTranslateY(y * yScale * zoom);
selectRect.setTranslateX(x * xScale);
selectRect.setTranslateY(y * yScale);
selectRect.setOpacity(0.5);
selectStartX = x;
selectStartY = y;
@ -266,10 +266,10 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
startSelection(x, y);
}
double minX = Math.min(selectStartX, x) * xScale * zoom;
double minY = Math.min(selectStartY, y) * yScale * zoom;
double maxX = Math.max(selectStartX, x) * xScale * zoom;
double maxY = Math.max(selectStartY, y) * yScale * zoom;
double minX = Math.min(selectStartX, x) * xScale;
double minY = Math.min(selectStartY, y) * yScale;
double maxX = Math.max(selectStartX, x) * xScale;
double maxY = Math.max(selectStartY, y) * yScale;
selectRect.setTranslateX(minX);
selectRect.setTranslateY(minY);
selectRect.setWidth(maxX - minX);

View File

@ -205,6 +205,8 @@ public class ImageEditorTabControllerImpl extends ImageEditorTabController {
currentImageEditor.setEntity(i);
currentImageEditor.buildEditorUI(imageEditorScrollAnchorPane);
currentImageEditor.buildPatternSelector(imagePatternMenu);
imageEditorZoomGroup.setScaleX(1.0);
imageEditorZoomGroup.setScaleY(1.0);
}
}