Skip to content

Commit c48f7cc

Browse files
authored
Merge pull request #3496 from ControlSystemStudio/CSSTUDIO-3364
CSSTUDIO-3364 Bugfix: Restore Zoom-level when restoring a layout.
2 parents b918fe4 + 5b9b254 commit c48f7cc

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/app/DisplayRuntimeInstance.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,22 @@ public void restore(final Memento memento)
244244
{
245245
memento.getString(TAG_ZOOM).ifPresent(level ->
246246
{
247-
// Simulate user input: Set value, invoke handler
248-
zoom_action.setValue(level);
249-
zoom_action.getOnAction().handle(null);
247+
Platform.runLater(() -> {
248+
// Simulate user input: Set value, invoke handler
249+
//
250+
// Run this inside Platform.runLater(), since
251+
// the constructor of ZoomAction also sets the zoom-
252+
// level (to the value set by the option
253+
// 'default_zoom_factor', which by default is set
254+
// to 100%) using Platform.runLater(). When
255+
// restoring an instance of Display Runtime,
256+
// DisplayRuntime.restore() is called _after_
257+
// the constructor of ZoomAction is called and
258+
// Platform.runLater() preserves the relative
259+
// ordering of Runnables when running them.
260+
zoom_action.setValue(level);
261+
zoom_action.getOnAction().handle(null);
262+
});
250263
});
251264
memento.getBoolean(TAG_TOOLBAR).ifPresent(this::showToolbar);
252265
}

0 commit comments

Comments
 (0)