@elyra/canvas 12.10.1 → 12.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-constants-7f93e705.js +2 -0
- package/dist/canvas-constants-7f93e705.js.map +1 -0
- package/dist/canvas-constants-ac5daafb.js +2 -0
- package/dist/canvas-constants-ac5daafb.js.map +1 -0
- package/dist/canvas-controller-09d0c333.js +2 -0
- package/dist/canvas-controller-09d0c333.js.map +1 -0
- package/dist/canvas-controller-c2793ca2.js +2 -0
- package/dist/canvas-controller-c2793ca2.js.map +1 -0
- package/dist/canvas-logger-815781bb.js +2 -0
- package/dist/canvas-logger-815781bb.js.map +1 -0
- package/dist/canvas-logger-a0f1beaa.js +2 -0
- package/dist/canvas-logger-a0f1beaa.js.map +1 -0
- package/dist/common-canvas-5b046a86.js +2 -0
- package/dist/common-canvas-5b046a86.js.map +1 -0
- package/dist/common-canvas-985cc0a2.js +2 -0
- package/dist/common-canvas-985cc0a2.js.map +1 -0
- package/dist/common-canvas.es.js +1 -1
- package/dist/common-canvas.es.js.map +1 -1
- package/dist/common-canvas.js +1 -1
- package/dist/common-canvas.js.map +1 -1
- package/dist/common-properties-4f471b2b.js +2 -0
- package/dist/common-properties-4f471b2b.js.map +1 -0
- package/dist/common-properties-9161cd27.js +2 -0
- package/dist/common-properties-9161cd27.js.map +1 -0
- package/dist/datarecord-metadata-v3-schema-bda88f2e.js +2 -0
- package/dist/datarecord-metadata-v3-schema-bda88f2e.js.map +1 -0
- package/dist/datarecord-metadata-v3-schema-d7ad05cd.js +2 -0
- package/dist/datarecord-metadata-v3-schema-d7ad05cd.js.map +1 -0
- package/dist/en-2ed89528.js +2 -0
- package/dist/en-2ed89528.js.map +1 -0
- package/dist/en-e93855cc.js +2 -0
- package/dist/en-e93855cc.js.map +1 -0
- package/dist/extends-39f57612.js +7 -0
- package/dist/extends-39f57612.js.map +1 -0
- package/dist/extends-51d9ddcc.js +7 -0
- package/dist/extends-51d9ddcc.js.map +1 -0
- package/dist/flexible-table-154a3359.js +2 -0
- package/dist/flexible-table-154a3359.js.map +1 -0
- package/dist/flexible-table-5e4a1e6d.js +2 -0
- package/dist/flexible-table-5e4a1e6d.js.map +1 -0
- package/dist/icon-811ffddd.js +2 -0
- package/dist/icon-811ffddd.js.map +1 -0
- package/dist/icon-d6909a68.js +2 -0
- package/dist/icon-d6909a68.js.map +1 -0
- package/dist/index-4fd90a14.js +2 -0
- package/dist/index-4fd90a14.js.map +1 -0
- package/dist/index-6d138021.js +2 -0
- package/dist/index-6d138021.js.map +1 -0
- package/dist/isArrayLikeObject-31e5e646.js +2 -0
- package/dist/isArrayLikeObject-31e5e646.js.map +1 -0
- package/dist/isArrayLikeObject-7c33c7fd.js +2 -0
- package/dist/isArrayLikeObject-7c33c7fd.js.map +1 -0
- package/dist/lib/canvas-controller.es.js +1 -1
- package/dist/lib/canvas-controller.js +1 -1
- package/dist/lib/canvas.es.js +1 -1
- package/dist/lib/canvas.js +1 -1
- package/dist/lib/context-menu.es.js +1 -1
- package/dist/lib/context-menu.es.js.map +1 -1
- package/dist/lib/context-menu.js +1 -1
- package/dist/lib/context-menu.js.map +1 -1
- package/dist/lib/properties/field-picker.es.js +1 -1
- package/dist/lib/properties/field-picker.js +1 -1
- package/dist/lib/properties/flexible-table.es.js +1 -1
- package/dist/lib/properties/flexible-table.js +1 -1
- package/dist/lib/properties.es.js +1 -1
- package/dist/lib/properties.js +1 -1
- package/dist/lib/tooltip.es.js +1 -1
- package/dist/lib/tooltip.es.js.map +1 -1
- package/dist/lib/tooltip.js +1 -1
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/styles/common-canvas.min.css +1 -1
- package/dist/styles/common-canvas.min.css.map +1 -1
- package/dist/toolbar-335252dd.js +2 -0
- package/dist/toolbar-335252dd.js.map +1 -0
- package/dist/toolbar-85e6c77b.js +2 -0
- package/dist/toolbar-85e6c77b.js.map +1 -0
- package/locales/command-actions/locales/en.json +7 -1
- package/locales/command-actions/locales/eo.json +7 -1
- package/locales/command-actions/locales/index.js +3 -1
- package/locales/command-actions/locales/ko.json +9 -0
- package/locales/common-canvas/locales/en.json +1 -0
- package/locales/common-canvas/locales/eo.json +1 -0
- package/locales/common-canvas/locales/index.js +3 -1
- package/locales/common-canvas/locales/ko.json +32 -0
- package/locales/common-properties/locales/index.js +3 -1
- package/locales/common-properties/locales/ko.json +93 -0
- package/locales/palette/locales/index.js +3 -1
- package/locales/palette/locales/ko.json +10 -0
- package/locales/toolbar/locales/index.js +3 -1
- package/locales/toolbar/locales/ko.json +8 -0
- package/package.json +2 -1
- package/src/color-picker/color-picker-panel.jsx +61 -0
- package/src/color-picker/color-picker.jsx +37 -0
- package/src/color-picker/color-picker.scss +46 -0
- package/src/command-actions/colorSelectedObjectsAction.js +72 -0
- package/src/command-actions/deleteObjectsAction.js +16 -11
- package/src/command-actions/pasteAction.js +50 -21
- package/src/common-canvas/canvas-controller.js +32 -5
- package/src/common-canvas/cc-bottom-panel.jsx +34 -37
- package/src/common-canvas/cc-contents.jsx +110 -8
- package/src/common-canvas/cc-toolbar.jsx +3 -2
- package/src/common-canvas/common-canvas-utils.js +73 -90
- package/src/common-canvas/common-canvas.scss +28 -14
- package/src/common-canvas/constants/canvas-constants.js +17 -16
- package/src/common-canvas/label-util.js +1 -1
- package/src/common-canvas/svg-canvas-d3.js +20 -107
- package/src/common-canvas/svg-canvas-d3.scss +67 -6
- package/src/common-canvas/svg-canvas-pipeline.js +201 -0
- package/src/common-canvas/svg-canvas-renderer.js +325 -339
- package/src/common-canvas/svg-canvas-utils-links.js +3 -3
- package/src/common-canvas/svg-canvas-utils-nodes.js +22 -44
- package/src/common-properties/actions.js +4 -0
- package/src/common-properties/components/field-picker/field-picker.jsx +33 -36
- package/src/common-properties/components/field-picker/field-picker.scss +20 -23
- package/src/common-properties/components/flexible-table/flexible-table.jsx +46 -31
- package/src/common-properties/components/flexible-table/flexible-table.scss +14 -17
- package/src/common-properties/components/properties-buttons/properties-buttons.jsx +28 -21
- package/src/common-properties/components/table-buttons/table-buttons.jsx +3 -1
- package/src/common-properties/components/table-buttons/table-buttons.scss +8 -8
- package/src/common-properties/components/title-editor/title-editor.jsx +31 -4
- package/src/common-properties/components/title-editor/title-editor.scss +30 -5
- package/src/common-properties/components/virtualized-table/virtualized-table.jsx +119 -27
- package/src/common-properties/components/virtualized-table/virtualized-table.scss +72 -8
- package/src/common-properties/constants/constants.js +5 -1
- package/src/common-properties/constants/form-constants.js +1 -0
- package/src/common-properties/controls/abstract-table.jsx +12 -11
- package/src/common-properties/controls/abstract-table.scss +6 -2
- package/src/common-properties/controls/dropdown/dropdown.scss +4 -0
- package/src/common-properties/controls/expression/expression-builder/expression-select-field-function.jsx +2 -2
- package/src/common-properties/controls/expression/expression.scss +1 -1
- package/src/common-properties/controls/passwordfield/passwordfield.jsx +2 -2
- package/src/common-properties/controls/readonlytable/readonlytable.jsx +4 -2
- package/src/common-properties/controls/selectcolumns/selectcolumns.scss +0 -19
- package/src/common-properties/controls/someofselect/someofselect.scss +2 -2
- package/src/common-properties/form/ControlInfo.js +8 -0
- package/src/common-properties/form/EditorForm.js +4 -0
- package/src/common-properties/form/ParameterInfo.js +4 -0
- package/src/common-properties/panels/sub-panel/cell.jsx +18 -23
- package/src/common-properties/panels/sub-panel/sub-panel.scss +5 -22
- package/src/common-properties/properties-controller.js +18 -0
- package/src/common-properties/properties-main/properties-main.jsx +15 -9
- package/src/common-properties/properties-main/properties-main.scss +9 -2
- package/src/common-properties/properties-store.js +27 -1
- package/src/common-properties/reducers/properties-settings.js +17 -1
- package/src/context-menu/common-context-menu.jsx +74 -29
- package/src/context-menu/context-menu-wrapper.jsx +2 -2
- package/src/icons/icon.jsx +5 -46
- package/src/index.scss +1 -0
- package/src/object-model/api-pipeline.js +26 -43
- package/src/object-model/object-model.js +27 -3
- package/src/object-model/redux/canvas-store.js +68 -0
- package/src/object-model/redux/reducers/canvasinfo.js +36 -0
- package/src/object-model/redux/reducers/comments.js +58 -10
- package/src/object-model/redux/reducers/externalpipelineflows.js +1 -0
- package/src/object-model/redux/reducers/links.js +9 -7
- package/src/object-model/redux/reducers/selectioninfo.js +2 -1
- package/src/palette/palette-content-list-item.jsx +8 -1
- package/src/palette/palette-dialog-content-grid-node.jsx +8 -1
- package/src/palette/palette-flyout-utils.js +3 -3
- package/src/toolbar/toolbar-action-item.jsx +75 -11
- package/src/toolbar/toolbar-overflow-item.jsx +2 -3
- package/src/tooltip/tooltip.jsx +4 -1
- package/stats.html +1 -1
- package/dist/canvas-constants-af93267a.js +0 -2
- package/dist/canvas-constants-af93267a.js.map +0 -1
- package/dist/canvas-constants-ffce3b78.js +0 -2
- package/dist/canvas-constants-ffce3b78.js.map +0 -1
- package/dist/canvas-controller-27101eb5.js +0 -2
- package/dist/canvas-controller-27101eb5.js.map +0 -1
- package/dist/canvas-controller-a57e3b7a.js +0 -2
- package/dist/canvas-controller-a57e3b7a.js.map +0 -1
- package/dist/common-canvas-f409dcd4.js +0 -2
- package/dist/common-canvas-f409dcd4.js.map +0 -1
- package/dist/common-canvas-f6fc2fff.js +0 -2
- package/dist/common-canvas-f6fc2fff.js.map +0 -1
- package/dist/common-properties-653e50e3.js +0 -2
- package/dist/common-properties-653e50e3.js.map +0 -1
- package/dist/common-properties-e2c6def7.js +0 -2
- package/dist/common-properties-e2c6def7.js.map +0 -1
- package/dist/datarecord-metadata-v3-schema-10ddafaf.js +0 -2
- package/dist/datarecord-metadata-v3-schema-10ddafaf.js.map +0 -1
- package/dist/datarecord-metadata-v3-schema-1504c843.js +0 -2
- package/dist/datarecord-metadata-v3-schema-1504c843.js.map +0 -1
- package/dist/en-517f38fc.js +0 -2
- package/dist/en-517f38fc.js.map +0 -1
- package/dist/en-dc6f2e9f.js +0 -2
- package/dist/en-dc6f2e9f.js.map +0 -1
- package/dist/extends-5a45f92e.js +0 -7
- package/dist/extends-5a45f92e.js.map +0 -1
- package/dist/extends-a52336ca.js +0 -8
- package/dist/extends-a52336ca.js.map +0 -1
- package/dist/flexible-table-e6ccbe58.js +0 -2
- package/dist/flexible-table-e6ccbe58.js.map +0 -1
- package/dist/flexible-table-f60c1680.js +0 -2
- package/dist/flexible-table-f60c1680.js.map +0 -1
- package/dist/index-567978da.js +0 -2
- package/dist/index-567978da.js.map +0 -1
- package/dist/index-59486e9a.js +0 -2
- package/dist/index-59486e9a.js.map +0 -1
- package/dist/isEmpty-def8f509.js +0 -2
- package/dist/isEmpty-def8f509.js.map +0 -1
- package/dist/isEmpty-e171b734.js +0 -2
- package/dist/isEmpty-e171b734.js.map +0 -1
- package/dist/toolbar-404bf690.js +0 -2
- package/dist/toolbar-404bf690.js.map +0 -1
- package/dist/toolbar-611d8ab9.js +0 -2
- package/dist/toolbar-611d8ab9.js.map +0 -1
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
/* eslint no-invalid-this: "off" */
|
|
18
18
|
/* eslint brace-style: "off" */
|
|
19
19
|
/* eslint no-lonely-if: "off" */
|
|
20
|
+
/* eslint max-depth: "off" */
|
|
20
21
|
|
|
21
22
|
// Import just the D3 modules that are needed and combine them as the 'd3' object.
|
|
22
23
|
import * as d3Drag from "d3-drag";
|
|
@@ -26,7 +27,7 @@ import * as d3Fetch from "d3-fetch";
|
|
|
26
27
|
import * as d3Zoom from "./d3-zoom-extension/src";
|
|
27
28
|
const d3 = Object.assign({}, d3Drag, d3Ease, d3Selection, d3Fetch, d3Zoom);
|
|
28
29
|
|
|
29
|
-
import { cloneDeep, escape as escapeText, get,
|
|
30
|
+
import { cloneDeep, escape as escapeText, get, set,
|
|
30
31
|
unescape as unescapeText } from "lodash";
|
|
31
32
|
import { ASSOC_RIGHT_SIDE_CURVE, ASSOCIATION_LINK, NODE_LINK, COMMENT_LINK,
|
|
32
33
|
ASSOC_VAR_CURVE_LEFT, ASSOC_VAR_CURVE_RIGHT, ASSOC_VAR_DOUBLE_BACK_RIGHT,
|
|
@@ -50,6 +51,7 @@ import SvgCanvasNodes from "./svg-canvas-utils-nodes.js";
|
|
|
50
51
|
import SvgCanvasComments from "./svg-canvas-utils-comments.js";
|
|
51
52
|
import SvgCanvasLinks from "./svg-canvas-utils-links.js";
|
|
52
53
|
import SvgCanvasDecs from "./svg-canvas-utils-decs.js";
|
|
54
|
+
import SVGCanvasPipeline from "./svg-canvas-pipeline";
|
|
53
55
|
|
|
54
56
|
const showLinksTime = false;
|
|
55
57
|
|
|
@@ -82,8 +84,7 @@ export default class SVGCanvasRenderer {
|
|
|
82
84
|
this.config = config;
|
|
83
85
|
this.canvasController = canvasController;
|
|
84
86
|
this.objectModel = this.canvasController.getObjectModel();
|
|
85
|
-
this.activePipeline =
|
|
86
|
-
this.activePipeline = CanvasUtils.preProcessPipeline(this.activePipeline);
|
|
87
|
+
this.activePipeline = new SVGCanvasPipeline(pipelineId, canvasInfo);
|
|
87
88
|
|
|
88
89
|
// An array of renderers for the supernodes on the canvas.
|
|
89
90
|
this.superRenderers = [];
|
|
@@ -164,6 +165,15 @@ export default class SVGCanvasRenderer {
|
|
|
164
165
|
// option is switched on.
|
|
165
166
|
this.dragNewLinkOverNode = null;
|
|
166
167
|
|
|
168
|
+
|
|
169
|
+
// Flag to indicate if the current drag operation is for a node that can
|
|
170
|
+
// be inserted into a link. Such a node would need input and output ports.
|
|
171
|
+
this.existingNodeInsertableIntoLink = false;
|
|
172
|
+
|
|
173
|
+
// Flag to indicate if the current drag operation is for a node that can
|
|
174
|
+
// be attachd to a a detachd link.
|
|
175
|
+
this.existingNodeAttachableToDetachedLinks = false;
|
|
176
|
+
|
|
167
177
|
// Allow us to track when a selection is being made so there is
|
|
168
178
|
// no need to re-render whole canvas
|
|
169
179
|
this.selecting = false;
|
|
@@ -267,15 +277,6 @@ export default class SVGCanvasRenderer {
|
|
|
267
277
|
this.logger.logEndTimer("constructor" + pipelineId.substring(0, 5));
|
|
268
278
|
}
|
|
269
279
|
|
|
270
|
-
isCanvasEmptyOrBindingsOnly() {
|
|
271
|
-
return (isEmpty(this.activePipeline.nodes) || this.containsOnlyBindingNodes(this.activePipeline)) &&
|
|
272
|
-
isEmpty(this.activePipeline.comments);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
containsOnlyBindingNodes(pipeline) {
|
|
276
|
-
return !pipeline.nodes.find((node) => !CanvasUtils.isSuperBindingNode(node));
|
|
277
|
-
}
|
|
278
|
-
|
|
279
280
|
// Returns the data object for the parent supernode that references the
|
|
280
281
|
// active pipeline (managed by this renderer). We get the supernode by
|
|
281
282
|
// looking through the overall canvas info objects.
|
|
@@ -289,17 +290,13 @@ export default class SVGCanvasRenderer {
|
|
|
289
290
|
if (!node) {
|
|
290
291
|
node =
|
|
291
292
|
pipeline.nodes.find((n) =>
|
|
292
|
-
|
|
293
|
+
CanvasUtils.isSupernode(n) && n.id === this.supernodeInfo.id);
|
|
293
294
|
}
|
|
294
295
|
}
|
|
295
296
|
});
|
|
296
297
|
return node;
|
|
297
298
|
}
|
|
298
299
|
|
|
299
|
-
getSupernodes(pipeline) {
|
|
300
|
-
return pipeline.nodes.filter((node) => this.nodeUtils.isSupernode(node));
|
|
301
|
-
}
|
|
302
|
-
|
|
303
300
|
getZoomTransform() {
|
|
304
301
|
return this.zoomTransform;
|
|
305
302
|
}
|
|
@@ -312,19 +309,10 @@ export default class SVGCanvasRenderer {
|
|
|
312
309
|
this.zoomStartPoint = { x: 0, y: 0, k: 0 };
|
|
313
310
|
}
|
|
314
311
|
|
|
315
|
-
getActivePipeline(pipelineId) {
|
|
316
|
-
const pipeline = this.canvasInfo.pipelines.find((p) => p.id === pipelineId);
|
|
317
|
-
if (pipeline) {
|
|
318
|
-
return pipeline;
|
|
319
|
-
}
|
|
320
|
-
return { id: pipelineId, nodes: [], comments: [], links: [] };
|
|
321
|
-
}
|
|
322
|
-
|
|
323
312
|
setCanvasInfoRenderer(canvasInfo) {
|
|
324
313
|
this.logger.logStartTimer("setCanvasInfoRenderer" + this.pipelineId.substring(0, 5));
|
|
325
314
|
this.canvasInfo = canvasInfo;
|
|
326
|
-
this.activePipeline =
|
|
327
|
-
this.activePipeline = CanvasUtils.preProcessPipeline(this.activePipeline);
|
|
315
|
+
this.activePipeline = new SVGCanvasPipeline(this.pipelineId, canvasInfo);
|
|
328
316
|
this.canvasLayout = this.objectModel.getCanvasLayout(); // Refresh the canvas layout info in case it changed.
|
|
329
317
|
|
|
330
318
|
// Set the display state incase we changed from in-place to full-page
|
|
@@ -361,7 +349,7 @@ export default class SVGCanvasRenderer {
|
|
|
361
349
|
// undo action.
|
|
362
350
|
cleanUpSuperRenderers() {
|
|
363
351
|
const newSuperRenderers = [];
|
|
364
|
-
const supernodes = this.getSupernodes(
|
|
352
|
+
const supernodes = this.activePipeline.getSupernodes();
|
|
365
353
|
|
|
366
354
|
supernodes.forEach((supernode) => {
|
|
367
355
|
const ren = this.getRendererForSupernode(supernode);
|
|
@@ -530,7 +518,7 @@ export default class SVGCanvasRenderer {
|
|
|
530
518
|
// dimensions accordingly.
|
|
531
519
|
let topAreaHeight;
|
|
532
520
|
let svgHt;
|
|
533
|
-
if (
|
|
521
|
+
if (CanvasUtils.isExpanded(supernodeDatum)) {
|
|
534
522
|
topAreaHeight = this.canvasLayout.supernodeTopAreaHeight;
|
|
535
523
|
svgHt = supernodeDatum.height - (this.canvasLayout.supernodeTopAreaHeight + this.canvasLayout.supernodeSVGAreaPadding);
|
|
536
524
|
} else {
|
|
@@ -881,9 +869,9 @@ export default class SVGCanvasRenderer {
|
|
|
881
869
|
fObjectDiv.attr("width", labelDisplayLength);
|
|
882
870
|
}
|
|
883
871
|
|
|
884
|
-
//
|
|
885
|
-
//
|
|
886
|
-
const browserZoom =
|
|
872
|
+
// Get the amount the actual browser page is 'zoomed'. This is differet
|
|
873
|
+
// to the zoom amount for the canvas objects.
|
|
874
|
+
const browserZoom = this.getBrowserZoom();
|
|
887
875
|
|
|
888
876
|
// Calculate the center of the node area for positioning the mouse pointer
|
|
889
877
|
// on the image when it is being dragged.
|
|
@@ -897,6 +885,29 @@ export default class SVGCanvasRenderer {
|
|
|
897
885
|
};
|
|
898
886
|
}
|
|
899
887
|
|
|
888
|
+
// Returns the amount the actual browser page is 'zoomed'. This is differet
|
|
889
|
+
// to the zoom amount for the canvas objects. Unfortunately, this value is not
|
|
890
|
+
// returned the same for each type of browser so we have to calculate it based
|
|
891
|
+
// on the type of browser.
|
|
892
|
+
getBrowserZoom() {
|
|
893
|
+
let browserZoom = window.devicePixelRatio;
|
|
894
|
+
|
|
895
|
+
// Make sure we search for browser idntifiers in this order because with
|
|
896
|
+
// the Chrome browser userAgent contains the words "Chrome and "Safari"!
|
|
897
|
+
// However, with the Safari browser, userAgent only contains the word "Safari".
|
|
898
|
+
if (navigator.userAgent.includes("Chrome")) {
|
|
899
|
+
browserZoom = window.devicePixelRatio; // This works for Chrome
|
|
900
|
+
|
|
901
|
+
} else if (navigator.userAgent.includes("Safari")) {
|
|
902
|
+
browserZoom = (window.outerWidth - 8) / window.innerWidth; // This works for Safari
|
|
903
|
+
|
|
904
|
+
} else if (navigator.userAgent.includes("Firefox")) {
|
|
905
|
+
browserZoom = window.devicePixelRatio / 2; // This works for Firefox
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
return browserZoom;
|
|
909
|
+
}
|
|
910
|
+
|
|
900
911
|
// Returns an object containing the dimensions of the ghost node that hovers
|
|
901
912
|
// over canvas when a node is being dragged from the palette. The ghost node
|
|
902
913
|
// is based on the default node width and height so any change to these values
|
|
@@ -909,10 +920,22 @@ export default class SVGCanvasRenderer {
|
|
|
909
920
|
};
|
|
910
921
|
}
|
|
911
922
|
|
|
923
|
+
nodeTemplateDragStart(nodeTemplate) {
|
|
924
|
+
if (this.isNodeTemplateInsertableIntoLink(nodeTemplate)) {
|
|
925
|
+
this.setDataLinkSelectionAreaWider(true);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
nodeTemplateDragEnd(nodeTemplate) {
|
|
930
|
+
if (this.isNodeTemplateInsertableIntoLink(nodeTemplate)) {
|
|
931
|
+
this.setDataLinkSelectionAreaWider(false);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
912
935
|
// Highlights any data link, that an 'insertable' nodeTemplate from the
|
|
913
936
|
// palette, is dragged over. The x and y passed in are in page coordinates
|
|
914
937
|
// based on the top left corner of the page.
|
|
915
|
-
|
|
938
|
+
nodeTemplateDragOver(nodeTemplate, x, y) {
|
|
916
939
|
if (this.isNodeTemplateInsertableIntoLink(nodeTemplate)) {
|
|
917
940
|
const link = this.getLinkAtMousePos(x, y);
|
|
918
941
|
// Set highlighting when there is no link because this will turn
|
|
@@ -1121,7 +1144,7 @@ export default class SVGCanvasRenderer {
|
|
|
1121
1144
|
transformMousePosForNode(x, y) {
|
|
1122
1145
|
const mousePos = this.convertPageCoordsToCanvasCoords(x, y);
|
|
1123
1146
|
|
|
1124
|
-
// Offset mousePos so new node
|
|
1147
|
+
// Offset mousePos so new node appears in center of mouse location.
|
|
1125
1148
|
const ghost = this.getGhostDimensions();
|
|
1126
1149
|
mousePos.x -= ghost.width / 2;
|
|
1127
1150
|
mousePos.y -= ghost.height / 2;
|
|
@@ -1135,7 +1158,7 @@ export default class SVGCanvasRenderer {
|
|
|
1135
1158
|
// is not explicitely set to zero (which some crazy apps want to do!).
|
|
1136
1159
|
isNodeTemplateInsertableIntoLink(nodeTemplate) {
|
|
1137
1160
|
return this.config.enableInsertNodeDroppedOnLink &&
|
|
1138
|
-
|
|
1161
|
+
CanvasUtils.hasInputAndOutputPorts(nodeTemplate) &&
|
|
1139
1162
|
!this.isPortMaxCardinalityZero(nodeTemplate.inputs[0]) &&
|
|
1140
1163
|
!this.isPortMaxCardinalityZero(nodeTemplate.outputs[0]);
|
|
1141
1164
|
}
|
|
@@ -1146,9 +1169,9 @@ export default class SVGCanvasRenderer {
|
|
|
1146
1169
|
isExistingNodeInsertableIntoLink() {
|
|
1147
1170
|
return (this.config.enableInsertNodeDroppedOnLink &&
|
|
1148
1171
|
this.dragObjects.length === 1 &&
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
!
|
|
1172
|
+
CanvasUtils.isNode(this.dragObjects[0]) &&
|
|
1173
|
+
CanvasUtils.hasInputAndOutputPorts(this.dragObjects[0]) &&
|
|
1174
|
+
!CanvasUtils.isNodeDefaultPortsCardinalityAtMax(this.dragObjects[0], this.activePipeline.links));
|
|
1152
1175
|
}
|
|
1153
1176
|
|
|
1154
1177
|
// Returns true if the current drag objects array has a single node which
|
|
@@ -1157,7 +1180,7 @@ export default class SVGCanvasRenderer {
|
|
|
1157
1180
|
isExistingNodeAttachableToDetachedLinks() {
|
|
1158
1181
|
return (this.config.enableLinkSelection === LINK_SELECTION_DETACHABLE &&
|
|
1159
1182
|
this.dragObjects.length === 1 &&
|
|
1160
|
-
|
|
1183
|
+
CanvasUtils.isNode(this.dragObjects[0]));
|
|
1161
1184
|
}
|
|
1162
1185
|
|
|
1163
1186
|
// Returns true if the current node template being dragged from the palette
|
|
@@ -1214,35 +1237,8 @@ export default class SVGCanvasRenderer {
|
|
|
1214
1237
|
return false;
|
|
1215
1238
|
}
|
|
1216
1239
|
|
|
1217
|
-
getLink(linkId) {
|
|
1218
|
-
const link = this.activePipeline.links.find((l) => l.id === linkId);
|
|
1219
|
-
return (typeof link === "undefined") ? null : link;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
// Returns truthy if the object passed in is a node (and not a comment).
|
|
1223
|
-
// Comments don't have a type property.
|
|
1224
|
-
isNode(obj) {
|
|
1225
|
-
return obj.type;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
getNode(nodeId) {
|
|
1229
|
-
const node = this.activePipeline.nodes.find((nd) => nd.id === nodeId);
|
|
1230
|
-
return (typeof node === "undefined") ? null : node;
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
getNodes(nodeIds) {
|
|
1234
|
-
const nodes = [];
|
|
1235
|
-
nodeIds.forEach((nId) => {
|
|
1236
|
-
const n = this.getNode(nId);
|
|
1237
|
-
if (n) {
|
|
1238
|
-
nodes.push(n);
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
return nodes;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
1240
|
getNodePort(nodeId, portId, type) {
|
|
1245
|
-
const node = this.activePipeline.
|
|
1241
|
+
const node = this.activePipeline.getNode(nodeId);
|
|
1246
1242
|
if (node) {
|
|
1247
1243
|
let ports;
|
|
1248
1244
|
if (type === "input") {
|
|
@@ -1256,19 +1252,6 @@ export default class SVGCanvasRenderer {
|
|
|
1256
1252
|
return null;
|
|
1257
1253
|
}
|
|
1258
1254
|
|
|
1259
|
-
getComment(commentId) {
|
|
1260
|
-
const comment = this.activePipeline.comments.find((com) => com.id === commentId);
|
|
1261
|
-
return (typeof comment === "undefined") ? null : comment;
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
getNodeOrComment(id) {
|
|
1265
|
-
let obj = this.getNode(id);
|
|
1266
|
-
if (obj === null) {
|
|
1267
|
-
obj = this.getComment(id);
|
|
1268
|
-
}
|
|
1269
|
-
return obj;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
1255
|
// Sets the maximum zoom extent if we are the renderer of the top level flow
|
|
1273
1256
|
// or calls the same method on our parent renderer if we are a sub-flow. This
|
|
1274
1257
|
// means the factors will multiply as they percolate up to the top flow.
|
|
@@ -1375,7 +1358,7 @@ export default class SVGCanvasRenderer {
|
|
|
1375
1358
|
// to the SVG area. We only attach the zoom behaviour to the top most SVG
|
|
1376
1359
|
// area i.e. when we are displaying either the primary pipeline full page
|
|
1377
1360
|
// or a sub-pipeline full page.
|
|
1378
|
-
if (!this.
|
|
1361
|
+
if (!this.activePipeline.isEmptyOrBindingsOnly() &&
|
|
1379
1362
|
this.dispUtils.isDisplayingFullPage()) {
|
|
1380
1363
|
this.canvasSVG
|
|
1381
1364
|
.call(this.zoom);
|
|
@@ -1454,7 +1437,7 @@ export default class SVGCanvasRenderer {
|
|
|
1454
1437
|
getCanvasCursor() {
|
|
1455
1438
|
if (this.dispUtils.isDisplayingFullPage()) {
|
|
1456
1439
|
if (this.config.enableInteractionType === INTERACTION_TRACKPAD ||
|
|
1457
|
-
this.
|
|
1440
|
+
this.activePipeline.isEmptyOrBindingsOnly()) {
|
|
1458
1441
|
return "default";
|
|
1459
1442
|
}
|
|
1460
1443
|
return "grab";
|
|
@@ -1707,7 +1690,7 @@ export default class SVGCanvasRenderer {
|
|
|
1707
1690
|
|
|
1708
1691
|
getZoomToReveal(nodeIDs, xPos, yPos) {
|
|
1709
1692
|
const transformedSVGRect = this.getTransformedViewportDimensions();
|
|
1710
|
-
const nodes = this.getNodes(nodeIDs);
|
|
1693
|
+
const nodes = this.activePipeline.getNodes(nodeIDs);
|
|
1711
1694
|
const canvasDimensions = CanvasUtils.getCanvasDimensions(nodes, [], [], 0);
|
|
1712
1695
|
const canv = this.convertCanvasDimensionsAdjustedForScaleWithPadding(canvasDimensions, 1, 10);
|
|
1713
1696
|
const xPosInt = parseInt(xPos, 10);
|
|
@@ -2011,9 +1994,8 @@ export default class SVGCanvasRenderer {
|
|
|
2011
1994
|
// a sub-flow that map to a port in the containing supernode. The dimensions
|
|
2012
1995
|
// are scaled by k and padded by pad (if provided).
|
|
2013
1996
|
getCanvasDimensionsAdjustedForScale(k, pad) {
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2016
|
-
this.activePipeline.links, this.canvasLayout.commentHighlightGap);
|
|
1997
|
+
const gap = this.canvasLayout.commentHighlightGap;
|
|
1998
|
+
const canvasDimensions = this.activePipeline.getCanvasDimensions(gap);
|
|
2017
1999
|
return this.convertCanvasDimensionsAdjustedForScaleWithPadding(canvasDimensions, k, pad);
|
|
2018
2000
|
}
|
|
2019
2001
|
|
|
@@ -2106,43 +2088,17 @@ export default class SVGCanvasRenderer {
|
|
|
2106
2088
|
|
|
2107
2089
|
this.closeContextMenuIfOpen();
|
|
2108
2090
|
|
|
2109
|
-
// Note: Comment and Node resizing is started by the comment/
|
|
2091
|
+
// Note: Comment and Node resizing is started by the comment/node highlight rectangle.
|
|
2110
2092
|
if (this.commentSizing) {
|
|
2111
|
-
this.resizeObj = this.getComment(d.id);
|
|
2093
|
+
this.resizeObj = this.activePipeline.getComment(d.id);
|
|
2112
2094
|
this.initializeResizeVariables(this.resizeObj);
|
|
2113
2095
|
|
|
2114
2096
|
} else if (this.nodeSizing) {
|
|
2115
|
-
this.resizeObj = this.getNode(d.id);
|
|
2097
|
+
this.resizeObj = this.activePipeline.getNode(d.id);
|
|
2116
2098
|
this.initializeResizeVariables(this.resizeObj);
|
|
2117
2099
|
|
|
2118
2100
|
} else {
|
|
2119
|
-
this.
|
|
2120
|
-
this.dragOffsetX = 0;
|
|
2121
|
-
this.dragOffsetY = 0;
|
|
2122
|
-
this.dragRunningX = 0;
|
|
2123
|
-
this.dragRunningY = 0;
|
|
2124
|
-
this.dragObjects = this.getDragObjects(d);
|
|
2125
|
-
if (this.dragObjects && this.dragObjects.length > 0) {
|
|
2126
|
-
this.dragStartX = this.dragObjects[0].x_pos;
|
|
2127
|
-
this.dragStartY = this.dragObjects[0].y_pos;
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
// If we are dragging an 'insertable' node, set it to be translucent so
|
|
2131
|
-
// that, when it is dragged over a link line, the highlightd line can be seen OK.
|
|
2132
|
-
if (this.isExistingNodeInsertableIntoLink()) {
|
|
2133
|
-
this.setNodeTranslucentState(this.dragObjects[0].id, true);
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
// If we are dragging an 'attachable' node, set it to be translucent so
|
|
2137
|
-
// that, when it is dragged over link lines, the highlightd lines can be seen OK.
|
|
2138
|
-
if (this.isExistingNodeAttachableToDetachedLinks()) {
|
|
2139
|
-
const mousePos = this.getTransformedMousePos(d3Event);
|
|
2140
|
-
this.dragPointerOffsetInNode = {
|
|
2141
|
-
x: mousePos.x - this.dragObjects[0].x_pos,
|
|
2142
|
-
y: mousePos.y - this.dragObjects[0].y_pos
|
|
2143
|
-
};
|
|
2144
|
-
this.setNodeTranslucentState(this.dragObjects[0].id, true);
|
|
2145
|
-
}
|
|
2101
|
+
this.dragObjectsStart(d3Event, d);
|
|
2146
2102
|
}
|
|
2147
2103
|
this.logger.logEndTimer("dragStart", true);
|
|
2148
2104
|
}
|
|
@@ -2154,87 +2110,7 @@ export default class SVGCanvasRenderer {
|
|
|
2154
2110
|
} else if (this.nodeSizing) {
|
|
2155
2111
|
this.resizeNode(d3Event);
|
|
2156
2112
|
} else {
|
|
2157
|
-
this.
|
|
2158
|
-
this.dragOffsetY += d3Event.dy;
|
|
2159
|
-
|
|
2160
|
-
// Limit the size a drag can be so, when the user is dragging objects in
|
|
2161
|
-
// an in-place subflow they do not drag them too far.
|
|
2162
|
-
// this.logger.log("Drag offset X = " + this.dragOffsetX + " y = " + this.dragOffsetY);
|
|
2163
|
-
if (this.dispUtils.isDisplayingSubFlowInPlace() &&
|
|
2164
|
-
(this.dragOffsetX > 1000 || this.dragOffsetX < -1000 ||
|
|
2165
|
-
this.dragOffsetY > 1000 || this.dragOffsetY < -1000)) {
|
|
2166
|
-
this.dragOffsetX -= d3Event.dx;
|
|
2167
|
-
this.dragOffsetY -= d3Event.dy;
|
|
2168
|
-
|
|
2169
|
-
} else {
|
|
2170
|
-
let increment = { x: 0, y: 0 };
|
|
2171
|
-
|
|
2172
|
-
if (this.config.enableSnapToGridType === SNAP_TO_GRID_DURING) {
|
|
2173
|
-
const stgPos = this.snapToGridDraggedNode();
|
|
2174
|
-
|
|
2175
|
-
increment = {
|
|
2176
|
-
x: stgPos.x - this.dragObjects[0].x_pos,
|
|
2177
|
-
y: stgPos.y - this.dragObjects[0].y_pos
|
|
2178
|
-
};
|
|
2179
|
-
|
|
2180
|
-
} else {
|
|
2181
|
-
increment = {
|
|
2182
|
-
x: d3Event.dx,
|
|
2183
|
-
y: d3Event.dy
|
|
2184
|
-
};
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
this.dragRunningX += increment.x;
|
|
2188
|
-
this.dragRunningY += increment.y;
|
|
2189
|
-
|
|
2190
|
-
this.dragObjects.forEach((d) => {
|
|
2191
|
-
d.x_pos += increment.x;
|
|
2192
|
-
d.y_pos += increment.y;
|
|
2193
|
-
});
|
|
2194
|
-
|
|
2195
|
-
if (this.config.enableLinkSelection === LINK_SELECTION_DETACHABLE) {
|
|
2196
|
-
this.getSelectedLinks().forEach((link) => {
|
|
2197
|
-
if (link.srcPos) {
|
|
2198
|
-
link.srcPos.x_pos += increment.x;
|
|
2199
|
-
link.srcPos.y_pos += increment.y;
|
|
2200
|
-
}
|
|
2201
|
-
if (link.trgPos) {
|
|
2202
|
-
link.trgPos.x_pos += increment.x;
|
|
2203
|
-
link.trgPos.y_pos += increment.y;
|
|
2204
|
-
}
|
|
2205
|
-
});
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
this.displayCanvas();
|
|
2210
|
-
|
|
2211
|
-
if (this.isExistingNodeInsertableIntoLink()) {
|
|
2212
|
-
const link = this.getLinkAtMousePos(d3Event.sourceEvent.clientX, d3Event.sourceEvent.clientY);
|
|
2213
|
-
// Set highlighting when there is no link because this will turn
|
|
2214
|
-
// current highlighting off. And only switch on highlighting when we are
|
|
2215
|
-
// over a fully attached link (not a detached link) and provided the
|
|
2216
|
-
// link is not to/from the node being dragged (which is possible in
|
|
2217
|
-
// some odd situations).
|
|
2218
|
-
if (!link ||
|
|
2219
|
-
(this.isLinkFullyAttached(link) &&
|
|
2220
|
-
this.dragObjects[0].id !== link.srcNodeId &&
|
|
2221
|
-
this.dragObjects[0].id !== link.trgNodeId)) {
|
|
2222
|
-
this.setInsertNodeIntoLinkHighlighting(link);
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
if (this.isExistingNodeAttachableToDetachedLinks()) {
|
|
2227
|
-
const mousePos = this.getTransformedMousePos(d3Event);
|
|
2228
|
-
const node = this.dragObjects[0];
|
|
2229
|
-
const ghostArea = {
|
|
2230
|
-
x1: mousePos.x - this.dragPointerOffsetInNode.x,
|
|
2231
|
-
y1: mousePos.y - this.dragPointerOffsetInNode.y,
|
|
2232
|
-
x2: mousePos.x - this.dragPointerOffsetInNode.x + node.width,
|
|
2233
|
-
y2: mousePos.y - this.dragPointerOffsetInNode.y + node.height
|
|
2234
|
-
};
|
|
2235
|
-
const links = this.getAttachableLinksForNodeAtPos(node, ghostArea);
|
|
2236
|
-
this.setDetachedLinkHighlighting(links);
|
|
2237
|
-
}
|
|
2113
|
+
this.dragObjectsAction(d3Event);
|
|
2238
2114
|
}
|
|
2239
2115
|
|
|
2240
2116
|
this.logger.logEndTimer("dragMove", true);
|
|
@@ -2252,70 +2128,201 @@ export default class SVGCanvasRenderer {
|
|
|
2252
2128
|
this.endNodeSizing();
|
|
2253
2129
|
|
|
2254
2130
|
} else if (this.dragging) {
|
|
2255
|
-
|
|
2256
|
-
|
|
2131
|
+
this.dragObjectsEnd(d3Event, d);
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
this.logger.logEndTimer("dragEnd", true);
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
// Starts the dragging action for canvas objects (nodes and comments).
|
|
2138
|
+
dragObjectsStart(d3Event, d) {
|
|
2139
|
+
// Ensure flags are false before staring a new drag.
|
|
2140
|
+
this.existingNodeInsertableIntoLink = false;
|
|
2141
|
+
this.existingNodeAttachableToDetachedLinks = false;
|
|
2142
|
+
|
|
2143
|
+
this.dragging = true;
|
|
2144
|
+
this.dragOffsetX = 0;
|
|
2145
|
+
this.dragOffsetY = 0;
|
|
2146
|
+
this.dragRunningX = 0;
|
|
2147
|
+
this.dragRunningY = 0;
|
|
2148
|
+
this.dragObjects = this.getDragObjects(d);
|
|
2149
|
+
if (this.dragObjects && this.dragObjects.length > 0) {
|
|
2150
|
+
this.dragStartX = this.dragObjects[0].x_pos;
|
|
2151
|
+
this.dragStartY = this.dragObjects[0].y_pos;
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
// If we are dragging an 'insertable' node, set it to be translucent so
|
|
2155
|
+
// that, when it is dragged over a link line, the highlightd line can be seen OK.
|
|
2156
|
+
if (this.isExistingNodeInsertableIntoLink()) {
|
|
2157
|
+
this.existingNodeInsertableIntoLink = true;
|
|
2158
|
+
this.setNodeTranslucentState(this.dragObjects[0].id, true);
|
|
2159
|
+
this.setDataLinkSelectionAreaWider(true);
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
// If we are dragging an 'attachable' node, set it to be translucent so
|
|
2163
|
+
// that, when it is dragged over link lines, the highlightd lines can be seen OK.
|
|
2164
|
+
if (this.isExistingNodeAttachableToDetachedLinks()) {
|
|
2165
|
+
this.existingNodeAttachableToDetachedLinks = true;
|
|
2166
|
+
const mousePos = this.getTransformedMousePos(d3Event);
|
|
2167
|
+
this.dragPointerOffsetInNode = {
|
|
2168
|
+
x: mousePos.x - this.dragObjects[0].x_pos,
|
|
2169
|
+
y: mousePos.y - this.dragObjects[0].y_pos
|
|
2170
|
+
};
|
|
2171
|
+
this.setNodeTranslucentState(this.dragObjects[0].id, true);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
// Performs the dragging action for canvas objects (nodes and comments).
|
|
2176
|
+
dragObjectsAction(d3Event) {
|
|
2177
|
+
this.dragOffsetX += d3Event.dx;
|
|
2178
|
+
this.dragOffsetY += d3Event.dy;
|
|
2257
2179
|
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2180
|
+
// Limit the size a drag can be so, when the user is dragging objects in
|
|
2181
|
+
// an in-place subflow they do not drag them too far.
|
|
2182
|
+
// this.logger.log("Drag offset X = " + this.dragOffsetX + " y = " + this.dragOffsetY);
|
|
2183
|
+
if (this.dispUtils.isDisplayingSubFlowInPlace() &&
|
|
2184
|
+
(this.dragOffsetX > 1000 || this.dragOffsetX < -1000 ||
|
|
2185
|
+
this.dragOffsetY > 1000 || this.dragOffsetY < -1000)) {
|
|
2186
|
+
this.dragOffsetX -= d3Event.dx;
|
|
2187
|
+
this.dragOffsetY -= d3Event.dy;
|
|
2188
|
+
|
|
2189
|
+
} else {
|
|
2190
|
+
let increment = { x: 0, y: 0 };
|
|
2191
|
+
|
|
2192
|
+
if (this.config.enableSnapToGridType === SNAP_TO_GRID_DURING) {
|
|
2193
|
+
const stgPos = this.snapToGridDraggedNode();
|
|
2194
|
+
|
|
2195
|
+
increment = {
|
|
2196
|
+
x: stgPos.x - this.dragObjects[0].x_pos,
|
|
2197
|
+
y: stgPos.y - this.dragObjects[0].y_pos
|
|
2198
|
+
};
|
|
2264
2199
|
|
|
2265
2200
|
} else {
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
dragFinalOffset = {
|
|
2272
|
-
x: stgPos.x - this.dragStartX,
|
|
2273
|
-
y: stgPos.y - this.dragStartY
|
|
2274
|
-
};
|
|
2275
|
-
} else {
|
|
2276
|
-
dragFinalOffset = { x: this.dragRunningX, y: this.dragRunningY };
|
|
2277
|
-
}
|
|
2201
|
+
increment = {
|
|
2202
|
+
x: d3Event.dx,
|
|
2203
|
+
y: d3Event.dy
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2278
2206
|
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
editType: "attachNodeToLinks",
|
|
2293
|
-
editSource: "canvas",
|
|
2294
|
-
node: this.dragObjects[0],
|
|
2295
|
-
detachedLinks: this.dragOverDetachedLinks,
|
|
2296
|
-
offsetX: dragFinalOffset.x,
|
|
2297
|
-
offsetY: dragFinalOffset.y,
|
|
2298
|
-
pipelineId: this.activePipeline.id });
|
|
2299
|
-
} else {
|
|
2300
|
-
this.canvasController.editActionHandler({
|
|
2301
|
-
editType: "moveObjects",
|
|
2302
|
-
editSource: "canvas",
|
|
2303
|
-
nodes: this.dragObjects.map((o) => o.id),
|
|
2304
|
-
links: this.getSelectedLinks().filter((l) => l.srcPos || l.trgPos), // Filter detached links
|
|
2305
|
-
offsetX: dragFinalOffset.x,
|
|
2306
|
-
offsetY: dragFinalOffset.y,
|
|
2307
|
-
pipelineId: this.activePipeline.id });
|
|
2207
|
+
this.dragRunningX += increment.x;
|
|
2208
|
+
this.dragRunningY += increment.y;
|
|
2209
|
+
|
|
2210
|
+
this.dragObjects.forEach((d) => {
|
|
2211
|
+
d.x_pos += increment.x;
|
|
2212
|
+
d.y_pos += increment.y;
|
|
2213
|
+
});
|
|
2214
|
+
|
|
2215
|
+
if (this.config.enableLinkSelection === LINK_SELECTION_DETACHABLE) {
|
|
2216
|
+
this.getSelectedLinks().forEach((link) => {
|
|
2217
|
+
if (link.srcPos) {
|
|
2218
|
+
link.srcPos.x_pos += increment.x;
|
|
2219
|
+
link.srcPos.y_pos += increment.y;
|
|
2308
2220
|
}
|
|
2309
|
-
|
|
2221
|
+
if (link.trgPos) {
|
|
2222
|
+
link.trgPos.x_pos += increment.x;
|
|
2223
|
+
link.trgPos.y_pos += increment.y;
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2310
2226
|
}
|
|
2227
|
+
}
|
|
2311
2228
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
this.
|
|
2229
|
+
this.displayCanvas();
|
|
2230
|
+
|
|
2231
|
+
if (this.existingNodeInsertableIntoLink) {
|
|
2232
|
+
const link = this.getLinkAtMousePos(d3Event.sourceEvent.clientX, d3Event.sourceEvent.clientY);
|
|
2233
|
+
// Set highlighting when there is no link because this will turn
|
|
2234
|
+
// current highlighting off. And only switch on highlighting when we are
|
|
2235
|
+
// over a fully attached link (not a detached link) and provided the
|
|
2236
|
+
// link is not to/from the node being dragged (which is possible in
|
|
2237
|
+
// some odd situations).
|
|
2238
|
+
if (!link ||
|
|
2239
|
+
(this.isLinkFullyAttached(link) &&
|
|
2240
|
+
this.dragObjects[0].id !== link.srcNodeId &&
|
|
2241
|
+
this.dragObjects[0].id !== link.trgNodeId)) {
|
|
2242
|
+
this.setInsertNodeIntoLinkHighlighting(link);
|
|
2243
|
+
}
|
|
2316
2244
|
}
|
|
2317
2245
|
|
|
2318
|
-
this.
|
|
2246
|
+
if (this.existingNodeAttachableToDetachedLinks) {
|
|
2247
|
+
const mousePos = this.getTransformedMousePos(d3Event);
|
|
2248
|
+
const node = this.dragObjects[0];
|
|
2249
|
+
const ghostArea = {
|
|
2250
|
+
x1: mousePos.x - this.dragPointerOffsetInNode.x,
|
|
2251
|
+
y1: mousePos.y - this.dragPointerOffsetInNode.y,
|
|
2252
|
+
x2: mousePos.x - this.dragPointerOffsetInNode.x + node.width,
|
|
2253
|
+
y2: mousePos.y - this.dragPointerOffsetInNode.y + node.height
|
|
2254
|
+
};
|
|
2255
|
+
const links = this.getAttachableLinksForNodeAtPos(node, ghostArea);
|
|
2256
|
+
this.setDetachedLinkHighlighting(links);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
// Ends the dragging action for canvas objects (nodes and comments).
|
|
2261
|
+
dragObjectsEnd(d3Event, d) {
|
|
2262
|
+
// Set to false before updating object model so main body of displayNodes is run.
|
|
2263
|
+
this.dragging = false;
|
|
2264
|
+
|
|
2265
|
+
// If the pointer hasn't moved and enableDragWithoutSelect we interpret
|
|
2266
|
+
// that as a select on the object.
|
|
2267
|
+
if (this.dragOffsetX === 0 &&
|
|
2268
|
+
this.dragOffsetY === 0 &&
|
|
2269
|
+
this.config.enableDragWithoutSelect) {
|
|
2270
|
+
this.selectObjectSourceEvent(d3Event, d);
|
|
2271
|
+
|
|
2272
|
+
} else {
|
|
2273
|
+
if (this.dragRunningX !== 0 ||
|
|
2274
|
+
this.dragRunningY !== 0) {
|
|
2275
|
+
let dragFinalOffset = null;
|
|
2276
|
+
if (this.config.enableSnapToGridType === SNAP_TO_GRID_AFTER) {
|
|
2277
|
+
const stgPos = this.snapToGridDraggedNode();
|
|
2278
|
+
dragFinalOffset = {
|
|
2279
|
+
x: stgPos.x - this.dragStartX,
|
|
2280
|
+
y: stgPos.y - this.dragStartY
|
|
2281
|
+
};
|
|
2282
|
+
} else {
|
|
2283
|
+
dragFinalOffset = { x: this.dragRunningX, y: this.dragRunningY };
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
if (this.existingNodeInsertableIntoLink &&
|
|
2287
|
+
this.dragOverLink) {
|
|
2288
|
+
this.canvasController.editActionHandler({
|
|
2289
|
+
editType: "insertNodeIntoLink",
|
|
2290
|
+
editSource: "canvas",
|
|
2291
|
+
node: this.dragObjects[0],
|
|
2292
|
+
link: this.dragOverLink,
|
|
2293
|
+
offsetX: dragFinalOffset.x,
|
|
2294
|
+
offsetY: dragFinalOffset.y,
|
|
2295
|
+
pipelineId: this.activePipeline.id });
|
|
2296
|
+
|
|
2297
|
+
} else if (this.existingNodeAttachableToDetachedLinks &&
|
|
2298
|
+
this.dragOverDetachedLinks.length > 0) {
|
|
2299
|
+
this.canvasController.editActionHandler({
|
|
2300
|
+
editType: "attachNodeToLinks",
|
|
2301
|
+
editSource: "canvas",
|
|
2302
|
+
node: this.dragObjects[0],
|
|
2303
|
+
detachedLinks: this.dragOverDetachedLinks,
|
|
2304
|
+
offsetX: dragFinalOffset.x,
|
|
2305
|
+
offsetY: dragFinalOffset.y,
|
|
2306
|
+
pipelineId: this.activePipeline.id });
|
|
2307
|
+
|
|
2308
|
+
} else {
|
|
2309
|
+
this.canvasController.editActionHandler({
|
|
2310
|
+
editType: "moveObjects",
|
|
2311
|
+
editSource: "canvas",
|
|
2312
|
+
nodes: this.dragObjects.map((o) => o.id),
|
|
2313
|
+
links: this.getSelectedLinks().filter((l) => l.srcPos || l.trgPos), // Filter detached links
|
|
2314
|
+
offsetX: dragFinalOffset.x,
|
|
2315
|
+
offsetY: dragFinalOffset.y,
|
|
2316
|
+
pipelineId: this.activePipeline.id });
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
// Switch off any drag highlighting
|
|
2322
|
+
this.setDataLinkSelectionAreaWider(false);
|
|
2323
|
+
this.unsetNodeTranslucentState();
|
|
2324
|
+
this.unsetInsertNodeIntoLinkHighlighting();
|
|
2325
|
+
this.unsetDetachedLinkHighlighting();
|
|
2319
2326
|
}
|
|
2320
2327
|
|
|
2321
2328
|
dragStartLinkHandle(d3Event, d) {
|
|
@@ -2326,7 +2333,7 @@ export default class SVGCanvasRenderer {
|
|
|
2326
2333
|
this.draggingLinkHandle = true;
|
|
2327
2334
|
|
|
2328
2335
|
const handleSelection = d3.select(d3Event.sourceEvent.currentTarget);
|
|
2329
|
-
const link = this.getLink(d.id);
|
|
2336
|
+
const link = this.activePipeline.getLink(d.id);
|
|
2330
2337
|
const oldLink = cloneDeep(link);
|
|
2331
2338
|
|
|
2332
2339
|
const linkGrpSelector = this.getLinkGroupSelectionById(d.id);
|
|
@@ -2349,14 +2356,14 @@ export default class SVGCanvasRenderer {
|
|
|
2349
2356
|
if (this.draggingLinkData.endBeingDragged === "end") {
|
|
2350
2357
|
const links = this.activePipeline.links.filter((lnk) => lnk.id !== link.id);
|
|
2351
2358
|
this.setUnavailableTargetNodesHighlighting(
|
|
2352
|
-
this.getNode(this.draggingLinkData.link.srcNodeId),
|
|
2359
|
+
this.activePipeline.getNode(this.draggingLinkData.link.srcNodeId),
|
|
2353
2360
|
this.draggingLinkData.link.srcNodePortId,
|
|
2354
2361
|
links
|
|
2355
2362
|
);
|
|
2356
2363
|
} else if (this.draggingLinkData.endBeingDragged === "start") {
|
|
2357
2364
|
const links = this.activePipeline.links.filter((lnk) => lnk.id !== link.id);
|
|
2358
2365
|
this.setUnavailableSourceNodesHighlighting(
|
|
2359
|
-
this.getNode(this.draggingLinkData.oldLink.trgNodeId),
|
|
2366
|
+
this.activePipeline.getNode(this.draggingLinkData.oldLink.trgNodeId),
|
|
2360
2367
|
this.draggingLinkData.link.trgNodePortId,
|
|
2361
2368
|
links
|
|
2362
2369
|
);
|
|
@@ -2449,7 +2456,7 @@ export default class SVGCanvasRenderer {
|
|
|
2449
2456
|
const nodeGroupSel = this.getAllNodeGroupsSelection();
|
|
2450
2457
|
|
|
2451
2458
|
nodeGroupSel
|
|
2452
|
-
.datum((d) => this.getNode(d.id))
|
|
2459
|
+
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2453
2460
|
.attr("transform", (d) => `translate(${d.x_pos}, ${d.y_pos})`);
|
|
2454
2461
|
|
|
2455
2462
|
if (this.dispUtils.isDisplayingSubFlow()) {
|
|
@@ -2493,6 +2500,8 @@ export default class SVGCanvasRenderer {
|
|
|
2493
2500
|
}
|
|
2494
2501
|
|
|
2495
2502
|
createNodes(enter) {
|
|
2503
|
+
this.logger.logStartTimer("createNodes");
|
|
2504
|
+
|
|
2496
2505
|
const newNodeGroups = enter
|
|
2497
2506
|
.append("g")
|
|
2498
2507
|
.attr("data-id", (d) => this.getId("node_grp", d.id))
|
|
@@ -2504,7 +2513,7 @@ export default class SVGCanvasRenderer {
|
|
|
2504
2513
|
}
|
|
2505
2514
|
|
|
2506
2515
|
// Node Sizing Area.
|
|
2507
|
-
newNodeGroups.filter((d) =>
|
|
2516
|
+
newNodeGroups.filter((d) => CanvasUtils.isSupernode(d))
|
|
2508
2517
|
.append("path")
|
|
2509
2518
|
.attr("class", "d3-node-sizing")
|
|
2510
2519
|
.call(this.attachNodeSizingListeners.bind(this));
|
|
@@ -2538,31 +2547,35 @@ export default class SVGCanvasRenderer {
|
|
|
2538
2547
|
.append("xhtml:span") // Provide a namespace when span is inside foreignObject
|
|
2539
2548
|
.call(this.attachNodeLabelSpanListeners.bind(this));
|
|
2540
2549
|
|
|
2550
|
+
this.logger.logEndTimer("createNodes");
|
|
2551
|
+
|
|
2541
2552
|
return newNodeGroups;
|
|
2542
2553
|
}
|
|
2543
2554
|
|
|
2544
2555
|
updateNodes(joinedNodeGrps) {
|
|
2556
|
+
this.logger.logStartTimer("updateNodes");
|
|
2557
|
+
|
|
2545
2558
|
// Node Sizing Area
|
|
2546
2559
|
joinedNodeGrps.selectChildren(".d3-node-sizing")
|
|
2547
|
-
.datum((d) => this.getNode(d.id))
|
|
2560
|
+
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2548
2561
|
.attr("d", (d) => this.getNodeShapePathSizing(d));
|
|
2549
2562
|
|
|
2550
2563
|
// Node Selection Highlighting Outline.
|
|
2551
2564
|
joinedNodeGrps.selectChildren(".d3-node-selection-highlight")
|
|
2552
|
-
.datum((d) => this.getNode(d.id))
|
|
2565
|
+
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2553
2566
|
.attr("d", (d) => this.getNodeSelectionOutline(d))
|
|
2554
2567
|
.attr("data-selected", (d) => (this.objectModel.isSelected(d.id, this.activePipeline.id) ? "yes" : "no"))
|
|
2555
2568
|
.attr("style", (d) => this.getNodeSelectionOutlineStyle(d, "default"));
|
|
2556
2569
|
|
|
2557
2570
|
// Node Body
|
|
2558
2571
|
joinedNodeGrps.selectChildren(".d3-node-body-outline")
|
|
2559
|
-
.datum((d) => this.getNode(d.id))
|
|
2572
|
+
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2560
2573
|
.attr("d", (d) => this.getNodeShapePath(d))
|
|
2561
2574
|
.attr("style", (d) => this.getNodeBodyStyle(d, "default"));
|
|
2562
2575
|
|
|
2563
2576
|
// Node Image
|
|
2564
2577
|
joinedNodeGrps.selectChildren(".d3-node-image")
|
|
2565
|
-
.datum((d) => this.getNode(d.id))
|
|
2578
|
+
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2566
2579
|
.each((d, i, nodeGrps) => this.setNodeImageContent(nodeGrps[i], d))
|
|
2567
2580
|
.attr("x", (d) => this.nodeUtils.getNodeImagePosX(d))
|
|
2568
2581
|
.attr("y", (d) => this.nodeUtils.getNodeImagePosY(d))
|
|
@@ -2572,7 +2585,7 @@ export default class SVGCanvasRenderer {
|
|
|
2572
2585
|
|
|
2573
2586
|
// Node Label
|
|
2574
2587
|
joinedNodeGrps.selectChildren(".d3-foreign-object")
|
|
2575
|
-
.datum((d) => this.getNode(d.id))
|
|
2588
|
+
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2576
2589
|
.attr("x", (d) => this.nodeUtils.getNodeLabelPosX(d))
|
|
2577
2590
|
.attr("y", (d) => this.nodeUtils.getNodeLabelPosY(d))
|
|
2578
2591
|
.attr("width", (d) => this.nodeUtils.getNodeLabelWidth(d))
|
|
@@ -2599,7 +2612,7 @@ export default class SVGCanvasRenderer {
|
|
|
2599
2612
|
|
|
2600
2613
|
this.displayPorts(nodeGrp, d);
|
|
2601
2614
|
|
|
2602
|
-
if (
|
|
2615
|
+
if (CanvasUtils.isSupernode(d)) {
|
|
2603
2616
|
this.displaySupernodeContents(d, d3.select(grps[index]));
|
|
2604
2617
|
}
|
|
2605
2618
|
|
|
@@ -2612,6 +2625,7 @@ export default class SVGCanvasRenderer {
|
|
|
2612
2625
|
this.displayDecorations(d, DEC_NODE, nodeGrp, decorations);
|
|
2613
2626
|
}
|
|
2614
2627
|
});
|
|
2628
|
+
this.logger.logEndTimer("updateNodes");
|
|
2615
2629
|
}
|
|
2616
2630
|
|
|
2617
2631
|
// Handles the display of a supernode sub-flow contents or hides the contents
|
|
@@ -2619,7 +2633,7 @@ export default class SVGCanvasRenderer {
|
|
|
2619
2633
|
displaySupernodeContents(d, supernodeD3Object) {
|
|
2620
2634
|
let ren = this.getRendererForSupernode(d);
|
|
2621
2635
|
|
|
2622
|
-
if (
|
|
2636
|
+
if (CanvasUtils.isExpanded(d)) {
|
|
2623
2637
|
if (!ren) {
|
|
2624
2638
|
ren = this.createSupernodeRenderer(d, supernodeD3Object); // Create will call displayCanvas
|
|
2625
2639
|
this.superRenderers.push(ren);
|
|
@@ -2848,7 +2862,7 @@ export default class SVGCanvasRenderer {
|
|
|
2848
2862
|
attachNodeSizingListeners(nodeGrps) {
|
|
2849
2863
|
nodeGrps
|
|
2850
2864
|
.on("mousedown", (d3Event, d) => {
|
|
2851
|
-
if (
|
|
2865
|
+
if (CanvasUtils.isExpandedSupernode(d)) {
|
|
2852
2866
|
this.nodeSizing = true;
|
|
2853
2867
|
// Note - node resizing and finalization of size is handled by drag functions.
|
|
2854
2868
|
this.addTempCursorOverlay(this.nodeSizingCursor);
|
|
@@ -2862,7 +2876,7 @@ export default class SVGCanvasRenderer {
|
|
|
2862
2876
|
// the node outline.
|
|
2863
2877
|
.on("mousemove mouseenter", (d3Event, d) => {
|
|
2864
2878
|
if (this.config.enableEditingActions && // Only set cursor when we are able to edit nodes
|
|
2865
|
-
|
|
2879
|
+
CanvasUtils.isExpandedSupernode(d) &&
|
|
2866
2880
|
!this.isRegionSelectOrSizingInProgress()) { // Don't switch sizing direction if we are already sizing
|
|
2867
2881
|
let cursorType = "pointer";
|
|
2868
2882
|
if (!this.isPointerCloseToBodyEdge(d3Event, d)) {
|
|
@@ -2879,7 +2893,7 @@ export default class SVGCanvasRenderer {
|
|
|
2879
2893
|
nodeLabels
|
|
2880
2894
|
.on("mouseenter", (d3Event, d) => {
|
|
2881
2895
|
const labelSel = d3.select(d3Event.currentTarget);
|
|
2882
|
-
if (this.config.enableDisplayFullLabelOnHover && !
|
|
2896
|
+
if (this.config.enableDisplayFullLabelOnHover && !CanvasUtils.isExpandedSupernode(d)) {
|
|
2883
2897
|
const spanSel = labelSel.selectAll("span");
|
|
2884
2898
|
labelSel
|
|
2885
2899
|
.attr("x", this.nodeUtils.getNodeLabelHoverPosX(d))
|
|
@@ -2890,7 +2904,7 @@ export default class SVGCanvasRenderer {
|
|
|
2890
2904
|
})
|
|
2891
2905
|
.on("mouseleave", (d3Event, d) => {
|
|
2892
2906
|
const labelSel = d3.select(d3Event.currentTarget);
|
|
2893
|
-
if (this.config.enableDisplayFullLabelOnHover && !
|
|
2907
|
+
if (this.config.enableDisplayFullLabelOnHover && !CanvasUtils.isExpandedSupernode(d)) {
|
|
2894
2908
|
labelSel
|
|
2895
2909
|
.attr("x", this.nodeUtils.getNodeLabelPosX(d))
|
|
2896
2910
|
.attr("width", this.nodeUtils.getNodeLabelWidth(d))
|
|
@@ -2929,7 +2943,7 @@ export default class SVGCanvasRenderer {
|
|
|
2929
2943
|
// Make sure this is just a left mouse button click - we don't want context menu click starting a line being drawn
|
|
2930
2944
|
if (d3Event.button === 0) {
|
|
2931
2945
|
CanvasUtils.stopPropagationAndPreventDefault(d3Event); // Stops the node drag behavior when clicking on the handle/circle
|
|
2932
|
-
const srcNode = this.getNode(node.id);
|
|
2946
|
+
const srcNode = this.activePipeline.getNode(node.id);
|
|
2933
2947
|
this.drawingNewLinkData = {
|
|
2934
2948
|
srcObjId: node.id,
|
|
2935
2949
|
srcPortId: port.id,
|
|
@@ -2987,7 +3001,7 @@ export default class SVGCanvasRenderer {
|
|
|
2987
3001
|
// Make sure this is just a left mouse button click - we don't want context menu click starting a line being drawn
|
|
2988
3002
|
if (d3Event.button === 0) {
|
|
2989
3003
|
CanvasUtils.stopPropagationAndPreventDefault(d3Event); // Stops the node drag behavior when clicking on the handle/circle
|
|
2990
|
-
const srcNode = this.getNode(node.id);
|
|
3004
|
+
const srcNode = this.activePipeline.getNode(node.id);
|
|
2991
3005
|
if (!CanvasUtils.isSrcCardinalityAtMax(port.id, srcNode, this.activePipeline.links)) {
|
|
2992
3006
|
this.drawingNewLinkData = {
|
|
2993
3007
|
srcObjId: node.id,
|
|
@@ -3203,7 +3217,7 @@ export default class SVGCanvasRenderer {
|
|
|
3203
3217
|
// to be a timing issue since the same problem is not evident with the
|
|
3204
3218
|
// similar code for the node group object.
|
|
3205
3219
|
// TODO - Issue 2465 - Find out why this problem occurs.
|
|
3206
|
-
const objectTypeName = this.getObjectTypeName(d);
|
|
3220
|
+
const objectTypeName = this.activePipeline.getObjectTypeName(d);
|
|
3207
3221
|
if (objectTypeName === "node" || objectTypeName === "link") {
|
|
3208
3222
|
this.canvasController.clickActionHandler({
|
|
3209
3223
|
clickType: d3EventType === "contextmenu" || this.ellipsisClicked ? "SINGLE_CLICK_CONTEXTMENU" : "SINGLE_CLICK",
|
|
@@ -3215,16 +3229,6 @@ export default class SVGCanvasRenderer {
|
|
|
3215
3229
|
}
|
|
3216
3230
|
}
|
|
3217
3231
|
|
|
3218
|
-
// Returns the name of the type of object d.
|
|
3219
|
-
getObjectTypeName(d) {
|
|
3220
|
-
if (this.getComment(d.id)) {
|
|
3221
|
-
return "comment";
|
|
3222
|
-
} else if (this.getNode(d.id)) {
|
|
3223
|
-
return "node";
|
|
3224
|
-
}
|
|
3225
|
-
return "link";
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
3232
|
// Displays a set of decorations on either a node or link object.
|
|
3229
3233
|
// d - This is a node or link object.
|
|
3230
3234
|
// objType - A string set to either DEC_NODE or DEC_LINK.
|
|
@@ -3459,11 +3463,11 @@ export default class SVGCanvasRenderer {
|
|
|
3459
3463
|
if (!d.image) {
|
|
3460
3464
|
return null;
|
|
3461
3465
|
} else if (d.image === USE_DEFAULT_ICON) {
|
|
3462
|
-
if (
|
|
3466
|
+
if (CanvasUtils.isSupernode(d)) {
|
|
3463
3467
|
return SUPERNODE_ICON;
|
|
3464
3468
|
}
|
|
3465
3469
|
} else if (d.image === USE_DEFAULT_EXT_ICON) {
|
|
3466
|
-
if (
|
|
3470
|
+
if (CanvasUtils.isSupernode(d)) {
|
|
3467
3471
|
return SUPERNODE_EXT_ICON;
|
|
3468
3472
|
}
|
|
3469
3473
|
}
|
|
@@ -3538,14 +3542,14 @@ export default class SVGCanvasRenderer {
|
|
|
3538
3542
|
|
|
3539
3543
|
doesExpandedSupernodeHaveStyledNodes(d) {
|
|
3540
3544
|
let expandedSupernodeHaveStyledNodes = false;
|
|
3541
|
-
if (
|
|
3542
|
-
const subflow =
|
|
3545
|
+
if (CanvasUtils.isExpandedSupernode(d) && d.subflow_ref && d.subflow_ref.pipeline_id_ref) {
|
|
3546
|
+
const subflow = new SVGCanvasPipeline(d.subflow_ref.pipeline_id_ref, this.canvasInfo);
|
|
3543
3547
|
const nodeGrp = subflow.nodes;
|
|
3544
3548
|
nodeGrp.forEach((node) => {
|
|
3545
3549
|
if (node.style || node.style_temp) {
|
|
3546
3550
|
expandedSupernodeHaveStyledNodes = true;
|
|
3547
3551
|
return;
|
|
3548
|
-
} else if (!expandedSupernodeHaveStyledNodes &&
|
|
3552
|
+
} else if (!expandedSupernodeHaveStyledNodes && CanvasUtils.isExpandedSupernode(node)) {
|
|
3549
3553
|
expandedSupernodeHaveStyledNodes = this.doesExpandedSupernodeHaveStyledNodes(node);
|
|
3550
3554
|
}
|
|
3551
3555
|
});
|
|
@@ -3643,7 +3647,7 @@ export default class SVGCanvasRenderer {
|
|
|
3643
3647
|
|
|
3644
3648
|
|
|
3645
3649
|
// Add Supernode expansion icon and background for expanded supernodes
|
|
3646
|
-
if (
|
|
3650
|
+
if (CanvasUtils.isExpandedSupernode(d)) {
|
|
3647
3651
|
const expGrp = nodeGrp
|
|
3648
3652
|
.append("g")
|
|
3649
3653
|
.attr("transform", (nd) => this.nodeUtils.getNodeExpansionIconTranslate(nd))
|
|
@@ -3730,13 +3734,6 @@ export default class SVGCanvasRenderer {
|
|
|
3730
3734
|
.attr("transform", (port) => this.getPortArrowPathTransform(port));
|
|
3731
3735
|
}
|
|
3732
3736
|
|
|
3733
|
-
// Returns true if the object passed in is a non-binding node. There's a
|
|
3734
|
-
// chance the object might be a comment so we make sure the object is a
|
|
3735
|
-
// node before checking the type.
|
|
3736
|
-
isNonBindingNode(obj) {
|
|
3737
|
-
return (this.isNode(obj) && obj.type !== "binding");
|
|
3738
|
-
}
|
|
3739
|
-
|
|
3740
3737
|
// Returns true if the port (from a node template) passed in has a max
|
|
3741
3738
|
// cardinaility of zero. If cardinality or cardinality.max is missing the
|
|
3742
3739
|
// max is considered to be non-zero.
|
|
@@ -3951,7 +3948,7 @@ export default class SVGCanvasRenderer {
|
|
|
3951
3948
|
|
|
3952
3949
|
drawNewCommentLinkForPorts(transPos) {
|
|
3953
3950
|
const that = this;
|
|
3954
|
-
const srcComment = this.getComment(this.drawingNewLinkData.srcObjId);
|
|
3951
|
+
const srcComment = this.activePipeline.getComment(this.drawingNewLinkData.srcObjId);
|
|
3955
3952
|
const startPos = this.linkUtils.getNewStraightCommentLinkStartPos(srcComment, transPos);
|
|
3956
3953
|
const linkType = COMMENT_LINK;
|
|
3957
3954
|
|
|
@@ -4044,7 +4041,7 @@ export default class SVGCanvasRenderer {
|
|
|
4044
4041
|
if (trgNode !== null) {
|
|
4045
4042
|
const type = this.drawingNewLinkData.action;
|
|
4046
4043
|
if (type === NODE_LINK) {
|
|
4047
|
-
const srcNode = this.getNode(this.drawingNewLinkData.srcObjId);
|
|
4044
|
+
const srcNode = this.activePipeline.getNode(this.drawingNewLinkData.srcObjId);
|
|
4048
4045
|
const srcPortId = this.drawingNewLinkData.srcPortId;
|
|
4049
4046
|
const trgPortId = this.getInputNodePortId(d3Event, trgNode);
|
|
4050
4047
|
|
|
@@ -4077,7 +4074,7 @@ export default class SVGCanvasRenderer {
|
|
|
4077
4074
|
}
|
|
4078
4075
|
|
|
4079
4076
|
} else if (type === ASSOCIATION_LINK) {
|
|
4080
|
-
const srcNode = this.getNode(this.drawingNewLinkData.srcObjId);
|
|
4077
|
+
const srcNode = this.activePipeline.getNode(this.drawingNewLinkData.srcObjId);
|
|
4081
4078
|
|
|
4082
4079
|
if (CanvasUtils.isAssocConnectionAllowed(srcNode, trgNode, this.activePipeline.links)) {
|
|
4083
4080
|
this.canvasController.editActionHandler({
|
|
@@ -4256,7 +4253,7 @@ export default class SVGCanvasRenderer {
|
|
|
4256
4253
|
newLink: newLink,
|
|
4257
4254
|
pipelineId: this.pipelineId });
|
|
4258
4255
|
} else {
|
|
4259
|
-
this.
|
|
4256
|
+
this.activePipeline.replaceLink(this.draggingLinkData.oldLink);
|
|
4260
4257
|
this.displayLinks();
|
|
4261
4258
|
}
|
|
4262
4259
|
|
|
@@ -4326,17 +4323,11 @@ export default class SVGCanvasRenderer {
|
|
|
4326
4323
|
return null;
|
|
4327
4324
|
}
|
|
4328
4325
|
|
|
4329
|
-
// Restores the link in the links array with the one passd in.
|
|
4330
|
-
restoreLink(oldLink) {
|
|
4331
|
-
const index = this.activePipeline.links.findIndex((l) => l.id === oldLink.id);
|
|
4332
|
-
this.activePipeline.links.splice(index, 1, oldLink);
|
|
4333
|
-
}
|
|
4334
|
-
|
|
4335
4326
|
// Returns true if the update command for a dragged link can be executed.
|
|
4336
4327
|
// It might be prevented from executing if either the course
|
|
4337
4328
|
canExecuteUpdateLinkCommand(newLink, oldLink) {
|
|
4338
|
-
const srcNode = this.getNode(newLink.srcNodeId);
|
|
4339
|
-
const trgNode = this.getNode(newLink.trgNodeId);
|
|
4329
|
+
const srcNode = this.activePipeline.getNode(newLink.srcNodeId);
|
|
4330
|
+
const trgNode = this.activePipeline.getNode(newLink.trgNodeId);
|
|
4340
4331
|
const linkSrcChanged = this.hasLinkSrcChanged(newLink, oldLink);
|
|
4341
4332
|
const linkTrgChanged = this.hasLinkTrgChanged(newLink, oldLink);
|
|
4342
4333
|
const links = this.activePipeline.links;
|
|
@@ -4418,20 +4409,11 @@ export default class SVGCanvasRenderer {
|
|
|
4418
4409
|
// Returns a link, if one can be found, at the position indicated by x and y
|
|
4419
4410
|
// coordinates.
|
|
4420
4411
|
getLinkAtMousePos(x, y) {
|
|
4421
|
-
const element = this.
|
|
4412
|
+
const element = this.getElementWithClassAtPosition(x, y, "d3-data-link");
|
|
4422
4413
|
const link = this.getNodeLinkForElement(element);
|
|
4423
4414
|
return link;
|
|
4424
4415
|
}
|
|
4425
4416
|
|
|
4426
|
-
// Returns a link DOM element, if one can be found, at the
|
|
4427
|
-
// position indicated by x and y coordinates.
|
|
4428
|
-
getLinkElementAtMousePos(x, y) {
|
|
4429
|
-
this.setDataLinkSelectionAreaWider(true);
|
|
4430
|
-
const element = this.getElementWithClassAtPosition(x, y, "d3-data-link");
|
|
4431
|
-
this.setDataLinkSelectionAreaWider(false);
|
|
4432
|
-
return element;
|
|
4433
|
-
}
|
|
4434
|
-
|
|
4435
4417
|
// Returns the node link object from the canvasInfo corresponding to the
|
|
4436
4418
|
// element passed in provided it is a 'path' DOM object. Returns null if
|
|
4437
4419
|
// a link cannot be found.
|
|
@@ -4439,7 +4421,7 @@ export default class SVGCanvasRenderer {
|
|
|
4439
4421
|
if (element) {
|
|
4440
4422
|
const datum = d3.select(element).datum();
|
|
4441
4423
|
if (datum) {
|
|
4442
|
-
var foundLink = this.getLink(datum.id
|
|
4424
|
+
var foundLink = this.activePipeline.getLink(datum.id);
|
|
4443
4425
|
if (foundLink && foundLink.type === NODE_LINK) {
|
|
4444
4426
|
return foundLink;
|
|
4445
4427
|
}
|
|
@@ -4448,8 +4430,12 @@ export default class SVGCanvasRenderer {
|
|
|
4448
4430
|
return null;
|
|
4449
4431
|
}
|
|
4450
4432
|
|
|
4433
|
+
// Switches the link selection area to be wider (when state is true) and
|
|
4434
|
+
// regular size (when state is false). The wider width assists detection
|
|
4435
|
+
// of a node being dragged over the link - for when the 'insert node into link'
|
|
4436
|
+
// feature is active.
|
|
4451
4437
|
setDataLinkSelectionAreaWider(state) {
|
|
4452
|
-
this.
|
|
4438
|
+
this.nodesLinksGrp.selectAll(".d3-data-link-selection-area").classed("d3-extra-width", state);
|
|
4453
4439
|
}
|
|
4454
4440
|
|
|
4455
4441
|
// Returns a node, if one can be found, at the position indicated by
|
|
@@ -4563,7 +4549,7 @@ export default class SVGCanvasRenderer {
|
|
|
4563
4549
|
if (element && element.nodeName === "g") {
|
|
4564
4550
|
const datum = d3.select(element).datum();
|
|
4565
4551
|
if (datum) {
|
|
4566
|
-
return this.getNode(datum.id);
|
|
4552
|
+
return this.activePipeline.getNode(datum.id);
|
|
4567
4553
|
}
|
|
4568
4554
|
}
|
|
4569
4555
|
return null;
|
|
@@ -4679,7 +4665,7 @@ export default class SVGCanvasRenderer {
|
|
|
4679
4665
|
|
|
4680
4666
|
// Returns a path string that will draw the selection outline shape of the node.
|
|
4681
4667
|
getNodeSelectionOutline(data) {
|
|
4682
|
-
if (data.layout.selectionPath && !
|
|
4668
|
+
if (data.layout.selectionPath && !CanvasUtils.isExpanded(data)) {
|
|
4683
4669
|
return data.layout.selectionPath;
|
|
4684
4670
|
|
|
4685
4671
|
} else if (data.layout.nodeShape === "port-arcs") {
|
|
@@ -4691,7 +4677,7 @@ export default class SVGCanvasRenderer {
|
|
|
4691
4677
|
|
|
4692
4678
|
// Returns a path string that will draw the body shape of the node.
|
|
4693
4679
|
getNodeShapePath(data) {
|
|
4694
|
-
if (data.layout.bodyPath && !
|
|
4680
|
+
if (data.layout.bodyPath && !CanvasUtils.isExpanded(data)) {
|
|
4695
4681
|
return data.layout.bodyPath;
|
|
4696
4682
|
|
|
4697
4683
|
} else if (data.layout.nodeShape === "port-arcs") {
|
|
@@ -4893,7 +4879,7 @@ export default class SVGCanvasRenderer {
|
|
|
4893
4879
|
} else {
|
|
4894
4880
|
let xPosition = 0;
|
|
4895
4881
|
|
|
4896
|
-
if (
|
|
4882
|
+
if (CanvasUtils.isExpandedSupernode(data)) {
|
|
4897
4883
|
const widthSvgArea = data.width - (2 * this.canvasLayout.supernodeSVGAreaPadding);
|
|
4898
4884
|
const remainingSpace = widthSvgArea - portsWidth;
|
|
4899
4885
|
xPosition = (2 * this.canvasLayout.supernodeSVGAreaPadding) + (remainingSpace / 2);
|
|
@@ -4947,7 +4933,7 @@ export default class SVGCanvasRenderer {
|
|
|
4947
4933
|
setPortPositionsLeftRightAllPorts(data, ports, portsHeight, xPos, yPos) {
|
|
4948
4934
|
let yPosition = 0;
|
|
4949
4935
|
|
|
4950
|
-
if (
|
|
4936
|
+
if (CanvasUtils.isExpandedSupernode(data)) {
|
|
4951
4937
|
const heightSvgArea = data.height - this.canvasLayout.supernodeTopAreaHeight - this.canvasLayout.supernodeSVGAreaPadding;
|
|
4952
4938
|
const remainingSpace = heightSvgArea - portsHeight;
|
|
4953
4939
|
yPosition = this.canvasLayout.supernodeTopAreaHeight + this.canvasLayout.supernodeSVGAreaPadding + (remainingSpace / 2);
|
|
@@ -4979,7 +4965,7 @@ export default class SVGCanvasRenderer {
|
|
|
4979
4965
|
// regular nodes or expanded supernodes.
|
|
4980
4966
|
setPortPositionsLeftRightSinglePort(data, ports, xPos, yPos) {
|
|
4981
4967
|
let yPosition = 0;
|
|
4982
|
-
if (
|
|
4968
|
+
if (CanvasUtils.isExpandedSupernode(data)) {
|
|
4983
4969
|
const heightSvgArea = data.height - this.canvasLayout.supernodeTopAreaHeight - this.canvasLayout.supernodeSVGAreaPadding;
|
|
4984
4970
|
yPosition = this.canvasLayout.supernodeTopAreaHeight + (heightSvgArea / 2);
|
|
4985
4971
|
|
|
@@ -5012,7 +4998,7 @@ export default class SVGCanvasRenderer {
|
|
|
5012
4998
|
displayMovedComments() {
|
|
5013
4999
|
this.getAllCommentGroupsSelection()
|
|
5014
5000
|
.attr("transform", (c) => `translate(${c.x_pos}, ${c.y_pos})`)
|
|
5015
|
-
.datum((d) => this.getComment(d.id));
|
|
5001
|
+
.datum((d) => this.activePipeline.getComment(d.id));
|
|
5016
5002
|
}
|
|
5017
5003
|
|
|
5018
5004
|
displayCommentsSelectionStatus() {
|
|
@@ -5088,7 +5074,7 @@ export default class SVGCanvasRenderer {
|
|
|
5088
5074
|
|
|
5089
5075
|
// Comment Sizing Area
|
|
5090
5076
|
joinedCommentGrps.selectChildren(".d3-comment-sizing")
|
|
5091
|
-
.datum((c) => this.getComment(c.id))
|
|
5077
|
+
.datum((c) => this.activePipeline.getComment(c.id))
|
|
5092
5078
|
.attr("x", -this.canvasLayout.commentSizingArea)
|
|
5093
5079
|
.attr("y", -this.canvasLayout.commentSizingArea)
|
|
5094
5080
|
.attr("height", (c) => c.height + (2 * this.canvasLayout.commentSizingArea))
|
|
@@ -5097,7 +5083,7 @@ export default class SVGCanvasRenderer {
|
|
|
5097
5083
|
|
|
5098
5084
|
// Comment Selection Highlighting Outline
|
|
5099
5085
|
joinedCommentGrps.selectChildren(".d3-comment-selection-highlight")
|
|
5100
|
-
.datum((c) => this.getComment(c.id))
|
|
5086
|
+
.datum((c) => this.activePipeline.getComment(c.id))
|
|
5101
5087
|
.attr("x", -this.canvasLayout.commentHighlightGap)
|
|
5102
5088
|
.attr("y", -this.canvasLayout.commentHighlightGap)
|
|
5103
5089
|
.attr("height", (c) => c.height + (2 * this.canvasLayout.commentHighlightGap))
|
|
@@ -5107,7 +5093,7 @@ export default class SVGCanvasRenderer {
|
|
|
5107
5093
|
|
|
5108
5094
|
// Comment Body
|
|
5109
5095
|
joinedCommentGrps.selectChildren(".d3-comment-rect")
|
|
5110
|
-
.datum((c) => this.getComment(c.id))
|
|
5096
|
+
.datum((c) => this.activePipeline.getComment(c.id))
|
|
5111
5097
|
.attr("height", (c) => c.height)
|
|
5112
5098
|
.attr("width", (c) => c.width)
|
|
5113
5099
|
.attr("class", "d3-comment-rect")
|
|
@@ -5115,7 +5101,7 @@ export default class SVGCanvasRenderer {
|
|
|
5115
5101
|
|
|
5116
5102
|
// Comment Text
|
|
5117
5103
|
joinedCommentGrps.selectChildren(".d3-foreign-object")
|
|
5118
|
-
.datum((c) => this.getComment(c.id))
|
|
5104
|
+
.datum((c) => this.activePipeline.getComment(c.id))
|
|
5119
5105
|
.attr("width", (c) => c.width)
|
|
5120
5106
|
.attr("height", (c) => c.height)
|
|
5121
5107
|
.select("div")
|
|
@@ -5299,14 +5285,14 @@ export default class SVGCanvasRenderer {
|
|
|
5299
5285
|
if (this.textAreaHeight < scrollHeight) {
|
|
5300
5286
|
this.textAreaHeight = scrollHeight;
|
|
5301
5287
|
foreignObject.style("height", this.textAreaHeight + "px");
|
|
5302
|
-
this.getComment(data.id).height = this.textAreaHeight;
|
|
5288
|
+
this.activePipeline.getComment(data.id).height = this.textAreaHeight;
|
|
5303
5289
|
this.displayComments();
|
|
5304
5290
|
this.displayLinks();
|
|
5305
5291
|
}
|
|
5306
5292
|
}
|
|
5307
5293
|
|
|
5308
5294
|
saveCommentChanges(id, newText, newHeight) {
|
|
5309
|
-
const comment = this.getComment(id);
|
|
5295
|
+
const comment = this.activePipeline.getComment(id);
|
|
5310
5296
|
const data = {
|
|
5311
5297
|
editType: "editComment",
|
|
5312
5298
|
editSource: "canvas",
|
|
@@ -5669,7 +5655,7 @@ export default class SVGCanvasRenderer {
|
|
|
5669
5655
|
if (this.config.enableMoveNodesOnSupernodeResize) {
|
|
5670
5656
|
const objectsInfo = CanvasUtils.moveSurroundingObjects(
|
|
5671
5657
|
oldSupernode,
|
|
5672
|
-
this.activePipeline.
|
|
5658
|
+
this.activePipeline.getNodesAndComments(),
|
|
5673
5659
|
this.nodeSizingDirection,
|
|
5674
5660
|
this.resizeObj.width,
|
|
5675
5661
|
this.resizeObj.height,
|
|
@@ -5954,13 +5940,13 @@ export default class SVGCanvasRenderer {
|
|
|
5954
5940
|
// Update link selection area
|
|
5955
5941
|
joinedLinkGrps
|
|
5956
5942
|
.selectAll(".d3-link-selection-area")
|
|
5957
|
-
.datum((d) => this.getLink(d.id))
|
|
5943
|
+
.datum((d) => this.activePipeline.getLink(d.id))
|
|
5958
5944
|
.attr("d", (d) => d.pathInfo.path);
|
|
5959
5945
|
|
|
5960
5946
|
// Update link line
|
|
5961
5947
|
joinedLinkGrps
|
|
5962
5948
|
.selectAll(".d3-link-line")
|
|
5963
|
-
.datum((d) => this.getLink(d.id))
|
|
5949
|
+
.datum((d) => this.activePipeline.getLink(d.id))
|
|
5964
5950
|
.attr("d", (d) => d.pathInfo.path)
|
|
5965
5951
|
.attr("class", "d3-link-line")
|
|
5966
5952
|
.attr("style", (d) => CanvasUtils.getObjectStyle(d, "line", "default"));
|
|
@@ -5971,7 +5957,7 @@ export default class SVGCanvasRenderer {
|
|
|
5971
5957
|
(d.type === COMMENT_LINK && this.canvasLayout.commentLinkArrowHead) ||
|
|
5972
5958
|
(d.type === NODE_LINK && this.canvasLayout.linkType === LINK_TYPE_STRAIGHT))
|
|
5973
5959
|
.selectAll(".d3-link-line-arrow-head")
|
|
5974
|
-
.datum((d) => this.getLink(d.id))
|
|
5960
|
+
.datum((d) => this.activePipeline.getLink(d.id))
|
|
5975
5961
|
.attr("d", (d) => this.getArrowHead(d))
|
|
5976
5962
|
.attr("transform", (d) => this.getArrowHeadTransform(d))
|
|
5977
5963
|
.attr("class", "d3-link-line-arrow-head")
|
|
@@ -6095,7 +6081,7 @@ export default class SVGCanvasRenderer {
|
|
|
6095
6081
|
updateHandles(handlesGrp, lineArray) {
|
|
6096
6082
|
handlesGrp
|
|
6097
6083
|
.selectAll(".d3-link-handle-start")
|
|
6098
|
-
.datum((d) => this.getLink(d.id))
|
|
6084
|
+
.datum((d) => this.activePipeline.getLink(d.id))
|
|
6099
6085
|
.each((datum, index, linkHandles) => {
|
|
6100
6086
|
const obj = d3.select(linkHandles[index]);
|
|
6101
6087
|
if (this.canvasLayout.linkStartHandleObject === "image") {
|
|
@@ -6116,7 +6102,7 @@ export default class SVGCanvasRenderer {
|
|
|
6116
6102
|
|
|
6117
6103
|
handlesGrp
|
|
6118
6104
|
.selectAll(".d3-link-handle-end")
|
|
6119
|
-
.datum((d) => this.getLink(d.id))
|
|
6105
|
+
.datum((d) => this.activePipeline.getLink(d.id))
|
|
6120
6106
|
.each((datum, index, linkHandles) => {
|
|
6121
6107
|
const obj = d3.select(linkHandles[index]);
|
|
6122
6108
|
if (this.canvasLayout.linkEndHandleObject === "image") {
|
|
@@ -6225,7 +6211,7 @@ export default class SVGCanvasRenderer {
|
|
|
6225
6211
|
customClass = " " + d.class_name;
|
|
6226
6212
|
}
|
|
6227
6213
|
|
|
6228
|
-
const supernodeClass =
|
|
6214
|
+
const supernodeClass = CanvasUtils.isExpandedSupernode(d)
|
|
6229
6215
|
? " d3-node-supernode-expanded"
|
|
6230
6216
|
: "";
|
|
6231
6217
|
|
|
@@ -6745,7 +6731,7 @@ export default class SVGCanvasRenderer {
|
|
|
6745
6731
|
str += " regionSelect = true";
|
|
6746
6732
|
}
|
|
6747
6733
|
if (str === "Flags:") {
|
|
6748
|
-
str += " None
|
|
6734
|
+
str += " None";
|
|
6749
6735
|
}
|
|
6750
6736
|
return str;
|
|
6751
6737
|
}
|