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

View File

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