Skip to content

Commit 432b6fd

Browse files
committed
CSSTUDIO-3364 Bugfix: restore Zoom-level when restoring a layout.
1 parent b8c388b commit 432b6fd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,20 @@ 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 100%) using Platform.runLater().
253+
// When restoring an instance of Display Runtime,
254+
// DisplayRuntime.restore() is called _after_
255+
// the constructor of ZoomAction is called and
256+
// Platform.runLater() preserves the relative
257+
// ordering of Runnables when running them.
258+
zoom_action.setValue(level);
259+
zoom_action.getOnAction().handle(null);
260+
});
250261
});
251262
memento.getBoolean(TAG_TOOLBAR).ifPresent(this::showToolbar);
252263
}

0 commit comments

Comments
 (0)