summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-11 19:05:45 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-11 19:05:45 +0800
commitb4e2f2d1505a3a9ae8b474b8eea271730a2db2ce (patch)
treecba7e01f526dae0a8fdc944365a37b08774f0f5f
parent68cb7b98a377b8de053817c386095006c0793569 (diff)
save new position after node dragged
save the new position after a node was dragged. Issue-ID: SDC-308 Change-Id: I647d9fc176d2495eb4031fa1c040cd379ade1156 Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
-rw-r--r--sdc-workflow-designer-ui/src/app/components/node/node.component.ts2
-rw-r--r--sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts35
2 files changed, 20 insertions, 17 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/node/node.component.ts b/sdc-workflow-designer-ui/src/app/components/node/node.component.ts
index e78c6e8c..5fe189db 100644
--- a/sdc-workflow-designer-ui/src/app/components/node/node.component.ts
+++ b/sdc-workflow-designer-ui/src/app/components/node/node.component.ts
@@ -41,7 +41,7 @@ export class NodeComponent implements AfterViewInit, OnDestroy {
ngAfterViewInit(): void {
if(this.last) {
- this.jsPlumbService.initNode('.node');
+ this.jsPlumbService.initNode();
this.jsPlumbService.connectNodes();
}
diff --git a/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts b/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts
index dc1d800f..6aa5028a 100644
--- a/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts
+++ b/sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts
@@ -119,25 +119,28 @@ export class JsPlumbService {
});
}
- public initNode(selectorString: string) {
- const selector = this.jsplumbInstance.getSelector(selectorString);
-
- this.jsplumbInstance.draggable(selector, {
- });
+ public initNode() {
+ this.processService.getProcess().forEach(node => {
+ this.jsplumbInstance.draggable(node.id, {
+ stop: event => {
+ node.position.left = event.pos[0];
+ node.position.top = event.pos[1];
+ },
+ });
- this.jsplumbInstance.makeTarget(selector, {
- detachable: false,
- isTarget: true,
- maxConnections: -1,
- });
+ this.jsplumbInstance.makeTarget(node.id, {
+ detachable: false,
+ isTarget: true,
+ maxConnections: -1,
+ });
- this.jsplumbInstance.makeSource(selector, {
- filter: '.anchor, .anchor *',
- detachable: false,
- isSource: true,
- maxConnections: -1,
+ this.jsplumbInstance.makeSource(node.id, {
+ filter: '.anchor, .anchor *',
+ detachable: false,
+ isSource: true,
+ maxConnections: -1,
+ });
});
-
}
public connectNodes() {