From 56a100e4e19e7da015789ea3b4125abcc092a488 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 2 Oct 2024 14:13:36 +0200 Subject: [PATCH 1/2] isMovable property --- .../client/source/class/osparc/workbench/BaseNodeUI.js | 10 ++++++++-- .../client/source/class/osparc/workbench/NodeUI.js | 2 +- .../class/osparc/workbench/WorkbenchUIPreview.js | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/workbench/BaseNodeUI.js b/services/static-webserver/client/source/class/osparc/workbench/BaseNodeUI.js index 2a778f12772..375b0c7f761 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/BaseNodeUI.js +++ b/services/static-webserver/client/source/class/osparc/workbench/BaseNodeUI.js @@ -87,6 +87,12 @@ qx.Class.define("osparc.workbench.BaseNodeUI", { appearance: { init: "window-small-cap", refine: true + }, + + isMovable: { + check: "Boolean", + init: true, + nullable: false } }, @@ -272,7 +278,7 @@ qx.Class.define("osparc.workbench.BaseNodeUI", { // override qx.ui.core.MMovable _onMovePointerMove: function(e) { // Only react when dragging is active - if (!this.hasState("move")) { + if (!this.hasState("move") || !this.getIsMovable()) { return; } e.stopPropagation(); @@ -290,7 +296,7 @@ qx.Class.define("osparc.workbench.BaseNodeUI", { } // Only react when dragging is active - if (!this.hasState("move")) { + if (!this.hasState("move") || !this.getIsMovable()) { return; } diff --git a/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js b/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js index 88dc0f97865..9d8a5f83b27 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js +++ b/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js @@ -619,7 +619,7 @@ qx.Class.define("osparc.workbench.NodeUI", { // override qx.ui.core.MMovable _onMovePointerMove: function(e) { // Only react when dragging is active - if (!this.hasState("move")) { + if (!this.hasState("move") || !this.getIsMovable()) { return; } const coords = this._setPositionFromEvent(e); diff --git a/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUIPreview.js b/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUIPreview.js index afef661e499..5adcb9ea00b 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUIPreview.js +++ b/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUIPreview.js @@ -60,6 +60,7 @@ qx.Class.define("osparc.workbench.WorkbenchUIPreview", { for (const nodeId in nodes) { const node = nodes[nodeId]; const nodeUI = this._createNodeUI(nodeId); + nodeUI.setIsMovable(false); this._addNodeUIToWorkbench(nodeUI, node.getPosition()); } qx.ui.core.queue.Layout.flush(); From 274dc7499cd20600b21fe8ab8ae36ebb5cd7af9e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 2 Oct 2024 14:55:55 +0200 Subject: [PATCH 2/2] change selection only if node is not selected --- .../client/source/class/osparc/workbench/WorkbenchUI.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js b/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js index c648b18e8d6..a11cb9ceb10 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js +++ b/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js @@ -496,7 +496,9 @@ qx.Class.define("osparc.workbench.WorkbenchUI", { nodeUI.addListener("requestOpenLogger", () => this.fireDataEvent("requestOpenLogger", nodeUI.getNodeId()), this); nodeUI.addListener("nodeMovingStart", () => { - this.__selectNode(nodeUI); + if (!this.getSelectedNodeIDs().includes(nodeUI.getNodeId())) { + this.__selectNode(nodeUI); + } this.__itemStartedMoving(); }, this);