From 61a60d3e170cebfd33e9b0c25b08fb0c7a5e2611 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 6 Mar 2020 08:39:35 +0100 Subject: [PATCH] Bug Fixed, time machines loosing their frame --- .../FunctionLibraries/UiObjectsFromNodes.js | 21 +++++++++++++++++++ Utilities.js | 1 - 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 19f48fa43..61b209594 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -399,6 +399,27 @@ function newUiObjectsFromNodes () { node.payload = payload node.type = uiObjectType + /* + Now we copy the possible frame saved to the payload where it can be used. A saved frame stores the position of a a chartingSpace object related to a node. + This will prevent that if those charting space objects never get activated, that the frame information is lost when the workspace is saved. + */ + if (node.savedPayload !== undefined) { + if (node.savedPayload.frame !== undefined) { + let frame = { + position: { + x: 0, + y: 0 + } + } + frame.position.x = node.savedPayload.frame.position.x + frame.position.y = node.savedPayload.frame.position.y + frame.width = node.savedPayload.frame.width + frame.height = node.savedPayload.frame.height + frame.radius = node.savedPayload.frame.radius + saveFrame(payload, frame) + } + } + /* Now we mount the floating object where the UIOBject will be laying on top of */ canvas.floatingSpace.uiObjectConstructor.createUiObject(userAddingNew, payload) diff --git a/Utilities.js b/Utilities.js index fe5e3b257..2588156b9 100644 --- a/Utilities.js +++ b/Utilities.js @@ -42,7 +42,6 @@ function loadPropertyFromNodeConfig (payload, propertyName) { } function saveFrame (payload, frame) { - if (frame.position.x === 0 && frame.position.y === 0) { return } payload.frame = { position: { x: frame.position.x,