From f96efe1740b0542f297bb6153436c6e3eeb5797c Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Tue, 5 Aug 2025 09:55:56 +0200 Subject: [PATCH 1/5] CSSTUDIO-3341 Bugfix: Zoom-level should not be applied twice, resulting in the zoom-level being squared. --- .../display/builder/representation/javafx/JFXRepresentation.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java index 9b191db3a5..3dc46f8eb7 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java @@ -491,7 +491,6 @@ else if (zoom == ZOOM_HEIGHT) zoom = Math.min(zoom_x, zoom_y); } - widget_parent.getTransforms().setAll(new Scale(zoom, zoom)); widget_pane.getTransforms().setAll(new Scale(zoom, zoom)); // Appears similar to using this API: // widget_parent.setScaleX(zoom); From 253f1a0a2fbbb498aff6936bf378726552d3138a Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Tue, 5 Aug 2025 13:29:34 +0200 Subject: [PATCH 2/5] CSSTUDIO-3341 Improvement: Avoid hiding content behind scrollbars when zooming using "WIDTH", "HEIGHT", or "ALL". --- .../javafx/JFXRepresentation.java | 186 +++++++++++++----- 1 file changed, 141 insertions(+), 45 deletions(-) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java index 3dc46f8eb7..04ffe033a4 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java @@ -25,8 +25,22 @@ import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import java.util.logging.Level; +import java.util.stream.Collectors; -import org.csstudio.display.builder.model.*; +import javafx.geometry.BoundingBox; +import javafx.geometry.Bounds; +import javafx.geometry.Insets; +import javafx.geometry.Orientation; +import javafx.geometry.Point2D; +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonType; +import javafx.scene.control.ChoiceDialog; +import javafx.scene.control.ScrollBar; +import javafx.scene.control.ScrollPane; +import org.csstudio.display.builder.model.DisplayModel; +import org.csstudio.display.builder.model.UntypedWidgetPropertyListener; +import org.csstudio.display.builder.model.Widget; +import org.csstudio.display.builder.model.WidgetPropertyListener; import org.csstudio.display.builder.model.properties.PredefinedColorMaps; import org.csstudio.display.builder.model.properties.WidgetColor; import org.csstudio.display.builder.representation.ToolkitRepresentation; @@ -47,18 +61,11 @@ import javafx.collections.ObservableList; import javafx.embed.swing.SwingFXUtils; import javafx.event.EventHandler; -import javafx.geometry.Bounds; -import javafx.geometry.Insets; -import javafx.geometry.Point2D; import javafx.scene.Cursor; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; -import javafx.scene.control.Alert; -import javafx.scene.control.ButtonType; -import javafx.scene.control.ChoiceDialog; -import javafx.scene.control.ScrollPane; import javafx.scene.image.WritableImage; import javafx.scene.input.MouseEvent; import javafx.scene.input.ScrollEvent; @@ -452,46 +459,135 @@ else if (level_spec.equalsIgnoreCase(Messages.Zoom_Height)) * @param zoom Zoom level: 1.0 for 100%, 0.5 for 50%, ZOOM_ALL, ZOOM_WIDTH, ZOOM_HEIGHT * @return Zoom level actually used */ - private double setZoom(double zoom) + private double setZoom(final double zoom) { + final double zoom_to_set; if (zoom <= 0.0) - { // Determine zoom to fit outline of display into available space - final Bounds available = model_root.getLayoutBounds(); - final Bounds outline = widget_pane.getLayoutBounds(); - - // 'outline' will wrap the actual widgets when the display - // is larger than the available viewport. - // So it can be used to zoom 'out'. - // But when the viewport is much larger than the widget, - // the JavaFX outline grows to fill the viewport, - // so falling back to the self-declared model width and height - // to zoom 'in'. - // This requires displays to be created with - // correct width/height properties. - final double zoom_x, zoom_y; - if (outline.getWidth() > available.getWidth()) - zoom_x = available.getWidth() / outline.getWidth(); - else if (model.propWidth().getValue() > 0) - zoom_x = available.getWidth() / model.propWidth().getValue(); - else - zoom_x = 1.0; - - if (outline.getHeight() > available.getHeight()) - zoom_y = available.getHeight() / outline.getHeight(); - else if (model.propHeight().getValue() > 0) - zoom_y = available.getHeight() / model.propHeight().getValue(); - else - zoom_y = 1.0; - - if (zoom == ZOOM_WIDTH) - zoom = zoom_x; - else if (zoom == ZOOM_HEIGHT) - zoom = zoom_y; - else // Assume ZOOM_ALL - zoom = Math.min(zoom_x, zoom_y); + { // Determine zoom to fit outline of display into available space. + // In order to determine the actual bounds within which an OPI + // can be displayed, model_root.getViewportBounds() is called + // and then the width/height of the scrollbars are added/subtracted + // in order to determine the bounds both _with_ and _without_ + // scrollbars being displayed. + boolean hScrollbarVisible = false; + boolean vScrollbarVisible = false; + double vScrollbarWidth = 0.0; + double hHcrollbarHeight = 0.0; + { + List scrollbars = model_root.lookupAll(".scroll-bar").stream().filter(node -> node instanceof ScrollBar).map(node -> (ScrollBar) node).collect(Collectors.toUnmodifiableList()); + List model_root_scrollbars = scrollbars.stream().filter(scrollbar -> scrollbar.getParent() == model_root).collect(Collectors.toUnmodifiableList()); + for (ScrollBar scrollBar : model_root_scrollbars) { + if (scrollBar.getOrientation() == Orientation.HORIZONTAL) { + hScrollbarVisible = scrollBar.isVisible(); + hHcrollbarHeight = scrollBar.getLayoutBounds().getHeight(); + } + else if (scrollBar.isVisible() && scrollBar.getOrientation() == Orientation.VERTICAL) { + vScrollbarVisible = scrollBar.isVisible(); + vScrollbarWidth = scrollBar.getLayoutBounds().getWidth(); + } + } + } + + final Bounds viewportBounds = model_root.getViewportBounds(); + final BoundingBox layoutBoundsWithoutScrollbars = new BoundingBox(viewportBounds.getMinX(), + viewportBounds.getMinY(), + Math.max(0.0, viewportBounds.getWidth() + (vScrollbarVisible ? vScrollbarWidth : 0.0)), + Math.max(0.0, viewportBounds.getHeight() + (hScrollbarVisible ? hHcrollbarHeight : 0.0))); + final BoundingBox layoutBoundsWithScrollbars = new BoundingBox(viewportBounds.getMinX(), + viewportBounds.getMinY(), + Math.max(0.0, viewportBounds.getWidth() - (vScrollbarVisible ? 0.0 : vScrollbarWidth)), + Math.max(0.0, viewportBounds.getHeight() - (hScrollbarVisible ? 0.0 : hHcrollbarHeight))); + + final double zoom_x_with_scrollbars_rounded; + final double zoom_x_without_scrollbars_rounded; + final double zoom_y_with_scrollbars_rounded; + final double zoom_y_without_scrollbars_rounded; + + { + final Bounds outline = widget_pane.getLayoutBounds(); + // 'outline' will wrap the actual widgets when the display + // is larger than the available viewport. + // So it can be used to zoom 'out'. + // But when the viewport is much larger than the widget, + // the JavaFX outline grows to fill the viewport, + // so falling back to the self-declared model width and height + // to zoom 'in'. + // This requires displays to be created with + // correct width/height properties. + final double zoom_x_without_scrollbars, zoom_y_without_scrollbars; + final double zoom_x_with_scrollbars, zoom_y_with_scrollbars; + if (outline.getWidth() > layoutBoundsWithScrollbars.getWidth()) { + zoom_x_without_scrollbars = layoutBoundsWithoutScrollbars.getWidth() / outline.getWidth(); + zoom_x_with_scrollbars = layoutBoundsWithScrollbars.getWidth() / outline.getWidth(); + } + else if (model.propWidth().getValue() > 0) { + zoom_x_without_scrollbars = layoutBoundsWithoutScrollbars.getWidth() / model.propWidth().getValue(); + zoom_x_with_scrollbars = layoutBoundsWithScrollbars.getWidth() / model.propWidth().getValue(); + } + else { + zoom_x_without_scrollbars = 1.0; + zoom_x_with_scrollbars = 1.0; + } + + if (outline.getHeight() > layoutBoundsWithScrollbars.getHeight()) { + zoom_y_without_scrollbars = layoutBoundsWithoutScrollbars.getHeight() / outline.getHeight(); + zoom_y_with_scrollbars = layoutBoundsWithScrollbars.getHeight() / outline.getHeight(); + } + else if (model.propHeight().getValue() > 0) { + zoom_y_without_scrollbars =layoutBoundsWithoutScrollbars.getHeight() / model.propHeight().getValue(); + zoom_y_with_scrollbars = layoutBoundsWithScrollbars.getHeight() / model.propHeight().getValue(); + } + else { + zoom_y_without_scrollbars = 1.0; + zoom_y_with_scrollbars = 1.0; + } + + zoom_x_with_scrollbars_rounded = Math.floor(zoom_x_with_scrollbars * 1000.0) / 1000.0; + zoom_x_without_scrollbars_rounded = Math.floor(zoom_x_without_scrollbars * 1000.0) / 1000.0; + zoom_y_with_scrollbars_rounded = Math.floor(zoom_y_with_scrollbars * 1000.0) / 1000.0; + zoom_y_without_scrollbars_rounded = Math.floor(zoom_y_without_scrollbars * 1000.0) / 1000.0; + } + + if (zoom == ZOOM_WIDTH) { + if (zoom_x_without_scrollbars_rounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { + // Setting zoom_to_set to 'zoom_x_without_scrollbars_rounded' + // would result in the horizontal scrollbar being shown. + // Therefore, set zoom_to_set = zoom_x_with_scrollbars_rounded + zoom_to_set = zoom_x_with_scrollbars_rounded; + } + else { + zoom_to_set = zoom_x_without_scrollbars_rounded; + } + } + else if (zoom == ZOOM_HEIGHT) { + if (zoom_y_without_scrollbars_rounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth()) { + // Setting zoom_to_set to 'zoom_y_without_scrollbars_rounded' + // would result in the vertical scrollbar being shown. + // Therefore, set zoom_to_set = zoom_y_with_scrollbars_rounded: + zoom_to_set = zoom_y_with_scrollbars_rounded; + } + else { + zoom_to_set = zoom_y_without_scrollbars_rounded; + } + } + else { + if (zoom_y_without_scrollbars_rounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth() || + zoom_x_without_scrollbars_rounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { + // Setting zoom_to_set to 'Math.min(zoom_x_without_scrollbars_rounded, zoom_y_with_scrollbars_rounded)' + // would result in at least either the vertical or the horizontal scrollbar being shown. + // Therefore, set zoom_to_set = Math.min(zoom_x_without_scrollbars_rounded, zoom_y_without_scrollbars_rounded): + zoom_to_set = Math.min(zoom_x_with_scrollbars_rounded, zoom_y_with_scrollbars_rounded); // Assume ZOOM_ALL + } + else { + zoom_to_set = Math.min(zoom_x_without_scrollbars_rounded, zoom_y_without_scrollbars_rounded); // Assume ZOOM_ALL + } + } + } + else { + zoom_to_set = zoom; } - widget_pane.getTransforms().setAll(new Scale(zoom, zoom)); + widget_pane.getTransforms().setAll(new Scale(zoom_to_set, zoom_to_set)); // Appears similar to using this API: // widget_parent.setScaleX(zoom); // widget_parent.setScaleY(zoom); @@ -505,7 +601,7 @@ else if (zoom == ZOOM_HEIGHT) if (isEditMode()) updateModelSizeIndicators(); - return zoom; + return zoom_to_set; } /** @return Zoom factor, 1.0 for 1:1 */ From ca594a32c3b18155d94e9c5b2bbfc1a48013df6d Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Tue, 5 Aug 2025 13:47:03 +0200 Subject: [PATCH 3/5] CSSTUDIO-3341 Add explanatory comment. --- .../builder/representation/javafx/JFXRepresentation.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java index 04ffe033a4..ad40cec6dd 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java @@ -542,6 +542,9 @@ else if (model.propHeight().getValue() > 0) { zoom_y_with_scrollbars = 1.0; } + // Round down the zoom-level in order to avoid situations where the + // zoom-level is instead being rounded up, causing a scrollbar to + // be displayed when a scrollbar is not needed. zoom_x_with_scrollbars_rounded = Math.floor(zoom_x_with_scrollbars * 1000.0) / 1000.0; zoom_x_without_scrollbars_rounded = Math.floor(zoom_x_without_scrollbars * 1000.0) / 1000.0; zoom_y_with_scrollbars_rounded = Math.floor(zoom_y_with_scrollbars * 1000.0) / 1000.0; From 34d8838d06a0795c1f7c54abd3f242a5887187e3 Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Wed, 6 Aug 2025 09:27:14 +0200 Subject: [PATCH 4/5] CSSTUDIO-3341 Move comment to correct place. --- .../builder/representation/javafx/JFXRepresentation.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java index ad40cec6dd..a62f3d0728 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java @@ -574,6 +574,7 @@ else if (zoom == ZOOM_HEIGHT) { } } else { + // Assume ZOOM_ALL if (zoom_y_without_scrollbars_rounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth() || zoom_x_without_scrollbars_rounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { // Setting zoom_to_set to 'Math.min(zoom_x_without_scrollbars_rounded, zoom_y_with_scrollbars_rounded)' @@ -582,7 +583,7 @@ else if (zoom == ZOOM_HEIGHT) { zoom_to_set = Math.min(zoom_x_with_scrollbars_rounded, zoom_y_with_scrollbars_rounded); // Assume ZOOM_ALL } else { - zoom_to_set = Math.min(zoom_x_without_scrollbars_rounded, zoom_y_without_scrollbars_rounded); // Assume ZOOM_ALL + zoom_to_set = Math.min(zoom_x_without_scrollbars_rounded, zoom_y_without_scrollbars_rounded); } } } From fdb77cd6d4fa3fee6a2a2f9b362c18b8a7295e4d Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Tue, 12 Aug 2025 13:54:32 +0200 Subject: [PATCH 5/5] CSSTUDIO-3341 Change variable names to camelCase. --- .../javafx/JFXRepresentation.java | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java index a62f3d0728..75bc3f2c12 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java @@ -461,7 +461,7 @@ else if (level_spec.equalsIgnoreCase(Messages.Zoom_Height)) */ private double setZoom(final double zoom) { - final double zoom_to_set; + final double zoomToSet; if (zoom <= 0.0) { // Determine zoom to fit outline of display into available space. // In order to determine the actual bounds within which an OPI @@ -475,8 +475,8 @@ private double setZoom(final double zoom) double hHcrollbarHeight = 0.0; { List scrollbars = model_root.lookupAll(".scroll-bar").stream().filter(node -> node instanceof ScrollBar).map(node -> (ScrollBar) node).collect(Collectors.toUnmodifiableList()); - List model_root_scrollbars = scrollbars.stream().filter(scrollbar -> scrollbar.getParent() == model_root).collect(Collectors.toUnmodifiableList()); - for (ScrollBar scrollBar : model_root_scrollbars) { + List modelRootScrollbars = scrollbars.stream().filter(scrollbar -> scrollbar.getParent() == model_root).collect(Collectors.toUnmodifiableList()); + for (ScrollBar scrollBar : modelRootScrollbars) { if (scrollBar.getOrientation() == Orientation.HORIZONTAL) { hScrollbarVisible = scrollBar.isVisible(); hHcrollbarHeight = scrollBar.getLayoutBounds().getHeight(); @@ -498,10 +498,10 @@ else if (scrollBar.isVisible() && scrollBar.getOrientation() == Orientation.VERT Math.max(0.0, viewportBounds.getWidth() - (vScrollbarVisible ? 0.0 : vScrollbarWidth)), Math.max(0.0, viewportBounds.getHeight() - (hScrollbarVisible ? 0.0 : hHcrollbarHeight))); - final double zoom_x_with_scrollbars_rounded; - final double zoom_x_without_scrollbars_rounded; - final double zoom_y_with_scrollbars_rounded; - final double zoom_y_without_scrollbars_rounded; + final double zoomXWithScrollbarsRounded; + final double zoomXWithoutScrollbarsRounded; + final double zoomYWithScrollbarsRounded; + final double zoomYWithoutScrollbarsRounded; { final Bounds outline = widget_pane.getLayoutBounds(); @@ -514,84 +514,84 @@ else if (scrollBar.isVisible() && scrollBar.getOrientation() == Orientation.VERT // to zoom 'in'. // This requires displays to be created with // correct width/height properties. - final double zoom_x_without_scrollbars, zoom_y_without_scrollbars; - final double zoom_x_with_scrollbars, zoom_y_with_scrollbars; + final double zoomXWithoutScrollbars, zoomYWithoutScrollbars; + final double zoomXWithScrollbars, zoomYWithScrollbars; if (outline.getWidth() > layoutBoundsWithScrollbars.getWidth()) { - zoom_x_without_scrollbars = layoutBoundsWithoutScrollbars.getWidth() / outline.getWidth(); - zoom_x_with_scrollbars = layoutBoundsWithScrollbars.getWidth() / outline.getWidth(); + zoomXWithoutScrollbars = layoutBoundsWithoutScrollbars.getWidth() / outline.getWidth(); + zoomXWithScrollbars = layoutBoundsWithScrollbars.getWidth() / outline.getWidth(); } else if (model.propWidth().getValue() > 0) { - zoom_x_without_scrollbars = layoutBoundsWithoutScrollbars.getWidth() / model.propWidth().getValue(); - zoom_x_with_scrollbars = layoutBoundsWithScrollbars.getWidth() / model.propWidth().getValue(); + zoomXWithoutScrollbars = layoutBoundsWithoutScrollbars.getWidth() / model.propWidth().getValue(); + zoomXWithScrollbars = layoutBoundsWithScrollbars.getWidth() / model.propWidth().getValue(); } else { - zoom_x_without_scrollbars = 1.0; - zoom_x_with_scrollbars = 1.0; + zoomXWithoutScrollbars = 1.0; + zoomXWithScrollbars = 1.0; } if (outline.getHeight() > layoutBoundsWithScrollbars.getHeight()) { - zoom_y_without_scrollbars = layoutBoundsWithoutScrollbars.getHeight() / outline.getHeight(); - zoom_y_with_scrollbars = layoutBoundsWithScrollbars.getHeight() / outline.getHeight(); + zoomYWithoutScrollbars = layoutBoundsWithoutScrollbars.getHeight() / outline.getHeight(); + zoomYWithScrollbars = layoutBoundsWithScrollbars.getHeight() / outline.getHeight(); } else if (model.propHeight().getValue() > 0) { - zoom_y_without_scrollbars =layoutBoundsWithoutScrollbars.getHeight() / model.propHeight().getValue(); - zoom_y_with_scrollbars = layoutBoundsWithScrollbars.getHeight() / model.propHeight().getValue(); + zoomYWithoutScrollbars =layoutBoundsWithoutScrollbars.getHeight() / model.propHeight().getValue(); + zoomYWithScrollbars = layoutBoundsWithScrollbars.getHeight() / model.propHeight().getValue(); } else { - zoom_y_without_scrollbars = 1.0; - zoom_y_with_scrollbars = 1.0; + zoomYWithoutScrollbars = 1.0; + zoomYWithScrollbars = 1.0; } // Round down the zoom-level in order to avoid situations where the // zoom-level is instead being rounded up, causing a scrollbar to // be displayed when a scrollbar is not needed. - zoom_x_with_scrollbars_rounded = Math.floor(zoom_x_with_scrollbars * 1000.0) / 1000.0; - zoom_x_without_scrollbars_rounded = Math.floor(zoom_x_without_scrollbars * 1000.0) / 1000.0; - zoom_y_with_scrollbars_rounded = Math.floor(zoom_y_with_scrollbars * 1000.0) / 1000.0; - zoom_y_without_scrollbars_rounded = Math.floor(zoom_y_without_scrollbars * 1000.0) / 1000.0; + zoomXWithScrollbarsRounded = Math.floor(zoomXWithScrollbars * 1000.0) / 1000.0; + zoomXWithoutScrollbarsRounded = Math.floor(zoomXWithoutScrollbars * 1000.0) / 1000.0; + zoomYWithScrollbarsRounded = Math.floor(zoomYWithScrollbars * 1000.0) / 1000.0; + zoomYWithoutScrollbarsRounded = Math.floor(zoomYWithoutScrollbars * 1000.0) / 1000.0; } if (zoom == ZOOM_WIDTH) { - if (zoom_x_without_scrollbars_rounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { - // Setting zoom_to_set to 'zoom_x_without_scrollbars_rounded' + if (zoomXWithoutScrollbarsRounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { + // Setting zoomToSet to 'zoomXWithoutScrollbarsRounded' // would result in the horizontal scrollbar being shown. - // Therefore, set zoom_to_set = zoom_x_with_scrollbars_rounded - zoom_to_set = zoom_x_with_scrollbars_rounded; + // Therefore, set zoomToSet = zoomXWithScrollbarsRounded + zoomToSet = zoomXWithScrollbarsRounded; } else { - zoom_to_set = zoom_x_without_scrollbars_rounded; + zoomToSet = zoomXWithoutScrollbarsRounded; } } else if (zoom == ZOOM_HEIGHT) { - if (zoom_y_without_scrollbars_rounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth()) { - // Setting zoom_to_set to 'zoom_y_without_scrollbars_rounded' + if (zoomYWithoutScrollbarsRounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth()) { + // Setting zoomToSet to 'zoomYWithoutScrollbarsRounded' // would result in the vertical scrollbar being shown. - // Therefore, set zoom_to_set = zoom_y_with_scrollbars_rounded: - zoom_to_set = zoom_y_with_scrollbars_rounded; + // Therefore, set zoomToSet = zoomYWithScrollbarsRounded: + zoomToSet = zoomYWithScrollbarsRounded; } else { - zoom_to_set = zoom_y_without_scrollbars_rounded; + zoomToSet = zoomYWithoutScrollbarsRounded; } } else { // Assume ZOOM_ALL - if (zoom_y_without_scrollbars_rounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth() || - zoom_x_without_scrollbars_rounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { - // Setting zoom_to_set to 'Math.min(zoom_x_without_scrollbars_rounded, zoom_y_with_scrollbars_rounded)' + if (zoomYWithoutScrollbarsRounded * model.propWidth().getValue() > layoutBoundsWithoutScrollbars.getWidth() || + zoomXWithoutScrollbarsRounded * model.propHeight().getValue() > layoutBoundsWithoutScrollbars.getHeight()) { + // Setting zoomToSet to 'Math.min(zoomXWithoutScrollbarsRounded, zoomYWithScrollbarsRounded)' // would result in at least either the vertical or the horizontal scrollbar being shown. - // Therefore, set zoom_to_set = Math.min(zoom_x_without_scrollbars_rounded, zoom_y_without_scrollbars_rounded): - zoom_to_set = Math.min(zoom_x_with_scrollbars_rounded, zoom_y_with_scrollbars_rounded); // Assume ZOOM_ALL + // Therefore, set zoomToSet = Math.min(zoomXWithoutScrollbarsRounded, zoomYWithoutScrollbarsRounded): + zoomToSet = Math.min(zoomXWithScrollbarsRounded, zoomYWithScrollbarsRounded); // Assume ZOOM_ALL } else { - zoom_to_set = Math.min(zoom_x_without_scrollbars_rounded, zoom_y_without_scrollbars_rounded); + zoomToSet = Math.min(zoomXWithoutScrollbarsRounded, zoomYWithoutScrollbarsRounded); } } } else { - zoom_to_set = zoom; + zoomToSet = zoom; } - widget_pane.getTransforms().setAll(new Scale(zoom_to_set, zoom_to_set)); + widget_pane.getTransforms().setAll(new Scale(zoomToSet, zoomToSet)); // Appears similar to using this API: // widget_parent.setScaleX(zoom); // widget_parent.setScaleY(zoom); @@ -605,7 +605,7 @@ else if (zoom == ZOOM_HEIGHT) { if (isEditMode()) updateModelSizeIndicators(); - return zoom_to_set; + return zoomToSet; } /** @return Zoom factor, 1.0 for 1:1 */