@elyra/canvas 12.43.0 → 12.45.0
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-acb99f64.js → canvas-constants-3bbfc8b1.js} +2 -2
- package/dist/{canvas-constants-acb99f64.js.map → canvas-constants-3bbfc8b1.js.map} +1 -1
- package/dist/{canvas-constants-ff5cf88e.js → canvas-constants-8d240dc6.js} +2 -2
- package/dist/{canvas-constants-ff5cf88e.js.map → canvas-constants-8d240dc6.js.map} +1 -1
- package/dist/canvas-controller-a926ab2b.js +2 -0
- package/dist/canvas-controller-a926ab2b.js.map +1 -0
- package/dist/canvas-controller-e2503333.js +2 -0
- package/dist/canvas-controller-e2503333.js.map +1 -0
- package/dist/{canvas-logger-295dafe4.js → canvas-logger-6f4b2551.js} +2 -2
- package/dist/{canvas-logger-295dafe4.js.map → canvas-logger-6f4b2551.js.map} +1 -1
- package/dist/{canvas-logger-e07a0b4a.js → canvas-logger-ab9d9048.js} +2 -2
- package/dist/{canvas-logger-e07a0b4a.js.map → canvas-logger-ab9d9048.js.map} +1 -1
- package/dist/common-canvas-41b0454f.js +2 -0
- package/dist/common-canvas-41b0454f.js.map +1 -0
- package/dist/common-canvas-460a4434.js +2 -0
- package/dist/common-canvas-460a4434.js.map +1 -0
- package/dist/common-canvas.es.js +1 -1
- package/dist/common-canvas.js +1 -1
- package/dist/common-properties-b25b4855.js +2 -0
- package/dist/{common-properties-08707efe.js.map → common-properties-b25b4855.js.map} +1 -1
- package/dist/common-properties-e262caa2.js +2 -0
- package/dist/{common-properties-acd55e94.js.map → common-properties-e262caa2.js.map} +1 -1
- package/dist/context-menu-wrapper-949393c7.js +2 -0
- package/dist/{context-menu-wrapper-e4a7ab4d.js.map → context-menu-wrapper-949393c7.js.map} +1 -1
- package/dist/context-menu-wrapper-f62dfcdb.js +2 -0
- package/dist/{context-menu-wrapper-271eb2df.js.map → context-menu-wrapper-f62dfcdb.js.map} +1 -1
- package/dist/{createClass-440000a3.js → createClass-02596015.js} +2 -2
- package/dist/createClass-02596015.js.map +1 -0
- package/dist/createClass-155bf7da.js +2 -0
- package/dist/createClass-155bf7da.js.map +1 -0
- package/dist/datarecord-metadata-v3-schema-2311ecab.js +2 -0
- package/dist/{datarecord-metadata-v3-schema-03427296.js.map → datarecord-metadata-v3-schema-2311ecab.js.map} +1 -1
- package/dist/datarecord-metadata-v3-schema-d279dbb0.js +2 -0
- package/dist/{datarecord-metadata-v3-schema-dba0b214.js.map → datarecord-metadata-v3-schema-d279dbb0.js.map} +1 -1
- package/dist/defineProperty-ad55dbff.js +2 -0
- package/dist/{defineProperty-3dc7d8d0.js.map → defineProperty-ad55dbff.js.map} +1 -1
- package/dist/{defineProperty-6d406743.js → defineProperty-bcc9968d.js} +2 -2
- package/dist/{defineProperty-6d406743.js.map → defineProperty-bcc9968d.js.map} +1 -1
- package/dist/flexible-table-c6a8b402.js +2 -0
- package/dist/{flexible-table-107ca2fd.js.map → flexible-table-c6a8b402.js.map} +1 -1
- package/dist/flexible-table-f7b294a0.js +2 -0
- package/dist/{flexible-table-5cc1ad6b.js.map → flexible-table-f7b294a0.js.map} +1 -1
- package/dist/{icon-2caf035c.js → icon-65758bb8.js} +2 -2
- package/dist/{icon-2caf035c.js.map → icon-65758bb8.js.map} +1 -1
- package/dist/{icon-e622f99b.js → icon-b3738f1f.js} +2 -2
- package/dist/{icon-e622f99b.js.map → icon-b3738f1f.js.map} +1 -1
- package/dist/index-9eeda306.js +2 -0
- package/dist/{index-5dac3da8.js.map → index-9eeda306.js.map} +1 -1
- package/dist/index-d3371fd0.js +2 -0
- package/dist/{index-fee06179.js.map → index-d3371fd0.js.map} +1 -1
- package/dist/inherits-42ae8426.js +2 -0
- package/dist/inherits-42ae8426.js.map +1 -0
- package/dist/inherits-75817f22.js +2 -0
- package/dist/inherits-75817f22.js.map +1 -0
- package/dist/isArrayLikeObject-04f333a5.js +1 -1
- package/dist/isArrayLikeObject-04f333a5.js.map +1 -1
- package/dist/isArrayLikeObject-7a30aa4b.js +1 -1
- package/dist/isArrayLikeObject-7a30aa4b.js.map +1 -1
- 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/command-stack.es.js +1 -1
- package/dist/lib/command-stack.es.js.map +1 -1
- package/dist/lib/command-stack.js +1 -1
- package/dist/lib/command-stack.js.map +1 -1
- package/dist/lib/context-menu.es.js +1 -1
- package/dist/lib/context-menu.js +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-6af353fa.js +2 -0
- package/dist/toolbar-6af353fa.js.map +1 -0
- package/dist/toolbar-c4e22755.js +2 -0
- package/dist/toolbar-c4e22755.js.map +1 -0
- package/locales/command-actions/locales/en.json +1 -0
- package/locales/command-actions/locales/eo.json +1 -0
- package/package.json +2 -2
- package/src/command-actions/sizeAndPositionObjectsAction.js +4 -0
- package/src/command-stack/command-stack.js +4 -0
- package/src/common-canvas/canvas-controller.js +47 -10
- package/src/common-canvas/cc-context-toolbar.jsx +46 -2
- package/src/common-canvas/cc-toolbar.jsx +12 -4
- package/src/common-canvas/common-canvas-utils.js +73 -2
- package/src/common-canvas/common-canvas.scss +5 -5
- package/src/common-canvas/constants/canvas-constants.js +1 -0
- package/src/common-canvas/svg-canvas-d3.js +2 -2
- package/src/common-canvas/svg-canvas-pipeline.js +1 -1
- package/src/common-canvas/svg-canvas-renderer.js +142 -75
- package/src/common-canvas/svg-canvas-utils-drag-objects.js +3 -0
- package/src/common-canvas/svg-canvas-utils-external.js +1 -1
- package/src/common-canvas/svg-canvas-utils-links.js +28 -32
- package/src/common-canvas/svg-canvas-utils-nodes.js +5 -13
- package/src/common-canvas/svg-canvas-utils-zoom.js +5 -4
- package/src/icons/icon.scss +1 -1
- package/src/object-model/config-utils.js +2 -2
- package/src/object-model/layout-dimensions.js +82 -87
- package/src/object-model/object-model-utils.js +271 -0
- package/src/object-model/object-model.js +28 -240
- package/src/toolbar/toolbar-action-item.jsx +2 -1
- package/src/toolbar/toolbar-button-item.jsx +3 -2
- package/src/toolbar/toolbar-overflow-item.jsx +10 -4
- package/src/toolbar/toolbar.jsx +5 -2
- package/src/toolbar/toolbar.scss +28 -31
- package/stats.html +1 -1
- package/dist/canvas-controller-6726b9ac.js +0 -2
- package/dist/canvas-controller-6726b9ac.js.map +0 -1
- package/dist/canvas-controller-6c6bc68f.js +0 -2
- package/dist/canvas-controller-6c6bc68f.js.map +0 -1
- package/dist/common-canvas-9374ef35.js +0 -2
- package/dist/common-canvas-9374ef35.js.map +0 -1
- package/dist/common-canvas-a6435bdb.js +0 -2
- package/dist/common-canvas-a6435bdb.js.map +0 -1
- package/dist/common-properties-08707efe.js +0 -2
- package/dist/common-properties-acd55e94.js +0 -2
- package/dist/context-menu-wrapper-271eb2df.js +0 -2
- package/dist/context-menu-wrapper-e4a7ab4d.js +0 -2
- package/dist/createClass-440000a3.js.map +0 -1
- package/dist/createClass-5ca26865.js +0 -2
- package/dist/createClass-5ca26865.js.map +0 -1
- package/dist/datarecord-metadata-v3-schema-03427296.js +0 -2
- package/dist/datarecord-metadata-v3-schema-dba0b214.js +0 -2
- package/dist/defineProperty-3dc7d8d0.js +0 -2
- package/dist/flexible-table-107ca2fd.js +0 -2
- package/dist/flexible-table-5cc1ad6b.js +0 -2
- package/dist/index-5dac3da8.js +0 -2
- package/dist/index-fee06179.js +0 -2
- package/dist/inherits-226dfdb2.js +0 -2
- package/dist/inherits-226dfdb2.js.map +0 -1
- package/dist/inherits-41673c87.js +0 -2
- package/dist/inherits-41673c87.js.map +0 -1
- package/dist/toolbar-ccc1d600.js +0 -2
- package/dist/toolbar-ccc1d600.js.map +0 -1
- package/dist/toolbar-e4445bf8.js +0 -2
- package/dist/toolbar-e4445bf8.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -245,34 +245,29 @@ export default class SvgCanvasLinks {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
getNodeLinkCoordsForPorts(srcNode, srcPortId, trgNode, trgPortId) {
|
|
248
|
-
let srcX
|
|
249
|
-
let srcY
|
|
250
|
-
let trgX
|
|
251
|
-
let trgY
|
|
252
|
-
|
|
253
|
-
if (this.canvasLayout.linkDirection === LINK_DIR_TOP_BOTTOM) {
|
|
254
|
-
srcX = srcNode.layout.outputPortBottomPosX;
|
|
255
|
-
srcY = srcNode.height + srcNode.layout.outputPortBottomPosY;
|
|
256
|
-
trgX = trgNode.layout.inputPortTopPosX;
|
|
257
|
-
trgY = trgNode.layout.inputPortTopPosY;
|
|
258
|
-
|
|
259
|
-
} else if (this.canvasLayout.linkDirection === LINK_DIR_BOTTOM_TOP) {
|
|
260
|
-
srcX = srcNode.layout.outputPortBottomPosX;
|
|
261
|
-
srcY = srcNode.layout.outputPortBottomPosY;
|
|
262
|
-
trgX = trgNode.layout.inputPortTopPosX;
|
|
263
|
-
trgY = trgNode.height + trgNode.layout.inputPortTopPosY;
|
|
264
|
-
}
|
|
248
|
+
let srcX;
|
|
249
|
+
let srcY;
|
|
250
|
+
let trgX;
|
|
251
|
+
let trgY;
|
|
265
252
|
|
|
266
253
|
if (srcNode.outputs && srcNode.outputs.length > 0) {
|
|
267
254
|
const port = srcNode.outputs.find((srcPort) => srcPort.id === srcPortId);
|
|
268
255
|
srcX = port ? port.cx : srcX;
|
|
269
256
|
srcY = port ? port.cy : srcY;
|
|
257
|
+
|
|
258
|
+
} else {
|
|
259
|
+
srcX = this.nodeUtils.getNodePortPosX(srcNode.layout.outputPortPositions[0], srcNode);
|
|
260
|
+
srcY = this.nodeUtils.getNodePortPosY(srcNode.layout.outputPortPositions[0], srcNode);
|
|
270
261
|
}
|
|
271
262
|
|
|
272
263
|
if (trgNode.inputs && trgNode.inputs.length > 0) {
|
|
273
264
|
const port = trgNode.inputs.find((trgPort) => trgPort.id === trgPortId);
|
|
274
265
|
trgX = port ? port.cx : trgX;
|
|
275
266
|
trgY = port ? port.cy : trgY;
|
|
267
|
+
|
|
268
|
+
} else {
|
|
269
|
+
trgX = this.nodeUtils.getNodePortPosX(trgNode.layout.inputPortPositions[0], trgNode);
|
|
270
|
+
trgY = this.nodeUtils.getNodePortPosY(trgNode.layout.inputPortPositions[0], trgNode);
|
|
276
271
|
}
|
|
277
272
|
|
|
278
273
|
return {
|
|
@@ -284,31 +279,32 @@ export default class SvgCanvasLinks {
|
|
|
284
279
|
}
|
|
285
280
|
|
|
286
281
|
getAssociationCurveLinkCoords(srcNode, trgNode, assocLinkVariation) {
|
|
287
|
-
let
|
|
288
|
-
let
|
|
282
|
+
let srcX = 0;
|
|
283
|
+
let trgX = 0;
|
|
289
284
|
|
|
290
285
|
if (assocLinkVariation === ASSOC_VAR_CURVE_RIGHT) {
|
|
291
|
-
|
|
292
|
-
|
|
286
|
+
srcX = srcNode.width;
|
|
287
|
+
trgX = 0;
|
|
293
288
|
|
|
294
289
|
} else if (assocLinkVariation === ASSOC_VAR_CURVE_LEFT) {
|
|
295
|
-
|
|
296
|
-
|
|
290
|
+
srcX = 0;
|
|
291
|
+
trgX = trgNode.width;
|
|
297
292
|
|
|
298
293
|
} else if (assocLinkVariation === ASSOC_VAR_DOUBLE_BACK_LEFT) {
|
|
299
|
-
|
|
300
|
-
|
|
294
|
+
srcX = 0;
|
|
295
|
+
trgX = 0;
|
|
301
296
|
|
|
302
297
|
} else {
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
srcX = srcNode.width;
|
|
299
|
+
trgX = trgNode.width;
|
|
305
300
|
}
|
|
306
301
|
|
|
307
302
|
return {
|
|
308
|
-
x1:
|
|
309
|
-
y1: srcNode.y_pos + srcNode.layout.
|
|
310
|
-
x2:
|
|
311
|
-
y2: trgNode.y_pos + trgNode.layout.
|
|
303
|
+
x1: srcNode.x_pos + srcX,
|
|
304
|
+
y1: srcNode.y_pos + this.nodeUtils.getNodePortPosY(srcNode.layout.outputPortPositions[0], srcNode),
|
|
305
|
+
x2: trgNode.x_pos + trgX,
|
|
306
|
+
y2: trgNode.y_pos + this.nodeUtils.getNodePortPosY(trgNode.layout.inputPortPositions[0], trgNode)
|
|
307
|
+
};
|
|
312
308
|
}
|
|
313
309
|
|
|
314
310
|
getCommentLinkCoords(srcComment, trgNode) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -339,20 +339,12 @@ export default class SvgCanvasNodes {
|
|
|
339
339
|
return node.layout.errorHeight;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
|
|
343
|
-
return this.getElementPosX(node.width,
|
|
342
|
+
getNodePortPosX(posInfo, node) {
|
|
343
|
+
return this.getElementPosX(node.width, posInfo.x_pos, posInfo.pos);
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
|
|
347
|
-
return this.getElementPosY(node.height,
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
getNodeOutputPortRightPosX(node) {
|
|
351
|
-
return this.getElementPosX(node.width, node.layout.outputPortRightPosX, node.layout.outputPortRightPosition);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
getNodeOutputPortRightPosY(node) {
|
|
355
|
-
return this.getElementPosY(node.height, node.layout.outputPortRightPosY, node.layout.outputPortRightPosition);
|
|
346
|
+
getNodePortPosY(posInfo, node) {
|
|
347
|
+
return this.getElementPosY(node.height, posInfo.y_pos, posInfo.pos);
|
|
356
348
|
}
|
|
357
349
|
|
|
358
350
|
getElementPosX(width, xOffset = 0, position = "topLeft") {
|
|
@@ -132,10 +132,11 @@ export default class SVGCanvasUtilsZoom {
|
|
|
132
132
|
this.zoomTransform = d3.zoomIdentity.translate(0, 0).scale(1);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
// Zooms the canvas to the extent specified in the zoom object.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
// Zooms the canvas to the extent specified in the zoom object. Animate
|
|
136
|
+
// the zoom by the time specified (in milliseconds) or by 500ms by default.
|
|
137
|
+
zoomTo(zoomObject, animateTime) {
|
|
138
|
+
const at = typeof animateTime === "undefined" ? 500 : animateTime;
|
|
139
|
+
this.zoomCanvasInvokeZoomBehavior(zoomObject, at);
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
// Pans the canvas by the x and y amount specified in the time specified.
|
package/src/icons/icon.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -21,7 +21,7 @@ import { isMatch, isMatchWith, omit } from "lodash";
|
|
|
21
21
|
import LayoutDimensions from "./layout-dimensions.js";
|
|
22
22
|
import { ASSOC_STRAIGHT, LINK_SELECTION_NONE } from "../common-canvas/constants/canvas-constants";
|
|
23
23
|
|
|
24
|
-
export default class
|
|
24
|
+
export default class ConfigUtils {
|
|
25
25
|
|
|
26
26
|
// Returns a config object which is the result of merging config into
|
|
27
27
|
// startConfig.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { cloneDeep } from "lodash";
|
|
18
|
+
|
|
17
19
|
const portsHorizontalDefaultLayout = {
|
|
18
20
|
nodeLayout: {
|
|
19
21
|
// Default node sizes. The height might be overridden for nodes with more ports
|
|
@@ -154,26 +156,19 @@ const portsHorizontalDefaultLayout = {
|
|
|
154
156
|
inputPortWidth: 12,
|
|
155
157
|
inputPortHeight: 12,
|
|
156
158
|
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// Position of bottom single input port. Multiple input ports will be
|
|
172
|
-
// automatically positioned with the X coordinate being overriden. These
|
|
173
|
-
// values are an offset from the bottom left corner of the node outline.
|
|
174
|
-
// Used when linkDirection is "BottomTop".
|
|
175
|
-
inputPortBottomPosX: 80,
|
|
176
|
-
inputPortBottomPosY: 0,
|
|
159
|
+
// Indicates whether multiple input ports should be automatically
|
|
160
|
+
// positioned (true) or positioned based on the contents of
|
|
161
|
+
// inputPortPositions array (false).
|
|
162
|
+
inputPortAutoPosition: true,
|
|
163
|
+
|
|
164
|
+
// An array of input port positions. Each element is structured like
|
|
165
|
+
// this: { x_pos: 5, y_pos: 10, pos: "topLeft" }. x_pos and y_pos are
|
|
166
|
+
// offsets from the pos point on the node.
|
|
167
|
+
// The order of the elements corresponds to the order of ports in the
|
|
168
|
+
// inputs array for the node.
|
|
169
|
+
inputPortPositions: [
|
|
170
|
+
{ x_pos: 0, y_pos: 20, pos: "topLeft" }
|
|
171
|
+
],
|
|
177
172
|
|
|
178
173
|
// The 'guide' is the object drawn at the mouse position as a new line
|
|
179
174
|
// is being dragged outwards.
|
|
@@ -196,27 +191,19 @@ const portsHorizontalDefaultLayout = {
|
|
|
196
191
|
outputPortWidth: 12,
|
|
197
192
|
outputPortHeight: 12,
|
|
198
193
|
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
outputPortTopPosY: 0,
|
|
213
|
-
|
|
214
|
-
// Position of bottom single output port. Multiple input ports will be
|
|
215
|
-
// automatically positioned with the X coordinate being overriden. These
|
|
216
|
-
// values are an offset from the bottom left corner of the node outline.
|
|
217
|
-
// Used when linkDirection is "TopBottom".
|
|
218
|
-
outputPortBottomPosX: 80,
|
|
219
|
-
outputPortBottomPosY: 0,
|
|
194
|
+
// Indicates whether multiple output ports should be automatically
|
|
195
|
+
// positioned (true) or positioned based on the contents of
|
|
196
|
+
// outputPortPositions array (false).
|
|
197
|
+
outputPortAutoPosition: true,
|
|
198
|
+
|
|
199
|
+
// An array of output port positions. Each element is structured like
|
|
200
|
+
// this: { x_pos: 5, y_pos: 10, pos: "topRight" }. x_pos and y_pos are
|
|
201
|
+
// offsets from the pos point on the node.
|
|
202
|
+
// The order of the elements corresponds to the order of ports in the
|
|
203
|
+
// outputs array for the node.
|
|
204
|
+
outputPortPositions: [
|
|
205
|
+
{ x_pos: 0, y_pos: 20, pos: "topRight" }
|
|
206
|
+
],
|
|
220
207
|
|
|
221
208
|
// The 'guide' is the object drawn at the mouse position as a new line
|
|
222
209
|
// is being dragged outwards.
|
|
@@ -412,7 +399,7 @@ const portsHorizontalDefaultLayout = {
|
|
|
412
399
|
// to switch the data-new-link-over attribute to "yes".
|
|
413
400
|
nodeProximity: 20,
|
|
414
401
|
|
|
415
|
-
// Adds additional area around the ghost
|
|
402
|
+
// Adds additional area around the ghost area dragged from the palette
|
|
416
403
|
// which can increase the possibility of detecting detached links.
|
|
417
404
|
ghostAreaPadding: 10,
|
|
418
405
|
|
|
@@ -569,26 +556,19 @@ const portsVerticalDefaultLayout = {
|
|
|
569
556
|
inputPortWidth: 12,
|
|
570
557
|
inputPortHeight: 12,
|
|
571
558
|
|
|
572
|
-
//
|
|
573
|
-
//
|
|
574
|
-
//
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
// Position of bottom single input port. Multiple input ports will be
|
|
587
|
-
// automatically positioned with the X coordinate being overriden. These
|
|
588
|
-
// values are an offset from the bottom left corner of the node outline.
|
|
589
|
-
// Used when linkDirection is "BottomTop".
|
|
590
|
-
inputPortBottomPosX: 35,
|
|
591
|
-
inputPortBottomPosY: 0,
|
|
559
|
+
// Indicates whether multiple input ports should be automatically
|
|
560
|
+
// positioned (true) or positioned based on the contents of
|
|
561
|
+
// inputPortPositions array (false).
|
|
562
|
+
inputPortAutoPosition: true,
|
|
563
|
+
|
|
564
|
+
// An array of input port positions. Each element is structured like
|
|
565
|
+
// this: { x_pos: 5, y_pos: 10, pos: "topLeft" }. x_pos and y_pos are
|
|
566
|
+
// offsets from the pos point on the node.
|
|
567
|
+
// The order of the elements corresponds to the order of ports in the
|
|
568
|
+
// inputs array for the node.
|
|
569
|
+
inputPortPositions: [
|
|
570
|
+
{ x_pos: 0, y_pos: 29, pos: "topLeft" }
|
|
571
|
+
],
|
|
592
572
|
|
|
593
573
|
// The 'guide' is the object drawn at the mouse position as a new line
|
|
594
574
|
// is being dragged outwards.
|
|
@@ -611,27 +591,19 @@ const portsVerticalDefaultLayout = {
|
|
|
611
591
|
outputPortWidth: 12,
|
|
612
592
|
outputPortHeight: 12,
|
|
613
593
|
|
|
614
|
-
//
|
|
615
|
-
//
|
|
616
|
-
//
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
//
|
|
623
|
-
//
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
outputPortTopPosY: 0,
|
|
628
|
-
|
|
629
|
-
// Position of bottom single input port. Multiple input ports will be
|
|
630
|
-
// automatically positioned with the X coordinate being overriden. These
|
|
631
|
-
// values are an offset from the bottom left corner of the node outline.
|
|
632
|
-
// Used when linkDirection is "TopBottom".
|
|
633
|
-
outputPortBottomPosX: 35,
|
|
634
|
-
outputPortBottomPosY: 0,
|
|
594
|
+
// Indicates whether multiple output ports should be automatically
|
|
595
|
+
// positioned (true) or positioned based on the contents of
|
|
596
|
+
// outputPortPositions array (false).
|
|
597
|
+
outputPortAutoPosition: true,
|
|
598
|
+
|
|
599
|
+
// An array of output port positions. Each element is structured like
|
|
600
|
+
// this: { x_pos: 5, y_pos: 10, pos: "topRight" }. x_pos and y_pos are
|
|
601
|
+
// offsets from the pos point on the node.
|
|
602
|
+
// The order of the elements corresponds to the order of ports in the
|
|
603
|
+
// outputs array for the node.
|
|
604
|
+
outputPortPositions: [
|
|
605
|
+
{ x_pos: 0, y_pos: 29, pos: "topRight" }
|
|
606
|
+
],
|
|
635
607
|
|
|
636
608
|
// The 'guide' is the object drawn at the mouse position as a new line
|
|
637
609
|
// is being dragged outwards.
|
|
@@ -827,7 +799,7 @@ const portsVerticalDefaultLayout = {
|
|
|
827
799
|
// to switch the data-new-link-over attribute to "yes".
|
|
828
800
|
nodeProximity: 20,
|
|
829
801
|
|
|
830
|
-
// Adds additional area around the ghost
|
|
802
|
+
// Adds additional area around the ghost area dragged from the palette
|
|
831
803
|
// which can increase the possibility of detecting detached links.
|
|
832
804
|
ghostAreaPadding: 10,
|
|
833
805
|
|
|
@@ -850,7 +822,8 @@ export default class LayoutDimensions {
|
|
|
850
822
|
let newLayout = this.getDefaultLayout(config);
|
|
851
823
|
|
|
852
824
|
if (config) {
|
|
853
|
-
newLayout = this.
|
|
825
|
+
newLayout = this.overridePortPositions(newLayout, config); // Must do this before overrideNodeLayout
|
|
826
|
+
newLayout = this.overrideNodeLayout(newLayout, overlayLayout); // Must do this before overrideSnapToGrid
|
|
854
827
|
newLayout = this.overrideCanvasLayout(newLayout, config, overlayLayout);
|
|
855
828
|
newLayout = this.overrideLinkType(newLayout, config);
|
|
856
829
|
newLayout = this.overrideSnapToGrid(newLayout, config);
|
|
@@ -867,7 +840,7 @@ export default class LayoutDimensions {
|
|
|
867
840
|
} else {
|
|
868
841
|
defaultLayout = portsHorizontalDefaultLayout;
|
|
869
842
|
}
|
|
870
|
-
return
|
|
843
|
+
return cloneDeep(defaultLayout);
|
|
871
844
|
}
|
|
872
845
|
|
|
873
846
|
static overrideNodeLayout(layout, overlayLayout) {
|
|
@@ -939,4 +912,26 @@ export default class LayoutDimensions {
|
|
|
939
912
|
}
|
|
940
913
|
return Number.parseInt(snapToGridSizeStr, 10);
|
|
941
914
|
}
|
|
915
|
+
|
|
916
|
+
// Overrides the port positioning fields in the layout based on the type of node
|
|
917
|
+
// and the link direction.
|
|
918
|
+
static overridePortPositions(layout, config) {
|
|
919
|
+
if (config.enableLinkDirection === "BottomTop") {
|
|
920
|
+
layout.nodeLayout.inputPortPositions = [
|
|
921
|
+
{ x_pos: 0, y_pos: 0, pos: "bottomCenter" }
|
|
922
|
+
];
|
|
923
|
+
layout.nodeLayout.outputPortPositions = [
|
|
924
|
+
{ x_pos: 0, y_pos: 0, pos: "topCenter" }
|
|
925
|
+
];
|
|
926
|
+
|
|
927
|
+
} else if (config.enableLinkDirection === "TopBottom") {
|
|
928
|
+
layout.nodeLayout.inputPortPositions = [
|
|
929
|
+
{ x_pos: 0, y_pos: 0, pos: "topCenter" }
|
|
930
|
+
];
|
|
931
|
+
layout.nodeLayout.outputPortPositions = [
|
|
932
|
+
{ x_pos: 0, y_pos: 0, pos: "bottomCenter" }
|
|
933
|
+
];
|
|
934
|
+
}
|
|
935
|
+
return layout;
|
|
936
|
+
}
|
|
942
937
|
}
|