@babylonjs/node-editor 5.0.4 → 5.3.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.
|
@@ -65199,7 +65199,7 @@ class GraphCanvasComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
|
65199
65199
|
this._frameIsMoving = false;
|
|
65200
65200
|
this._isLoading = false;
|
|
65201
65201
|
props.globalState.onSelectionChangedObservable.add((options) => {
|
|
65202
|
-
const { selection, forceKeepSelection } = options || {};
|
|
65202
|
+
const { selection, forceKeepSelection, marqueeSelection = false } = options || {};
|
|
65203
65203
|
if (!selection) {
|
|
65204
65204
|
this._selectedNodes = [];
|
|
65205
65205
|
this._selectedLink = null;
|
|
@@ -65213,41 +65213,6 @@ class GraphCanvasComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
|
65213
65213
|
this._selectedLink = selection;
|
|
65214
65214
|
this._selectedPort = null;
|
|
65215
65215
|
}
|
|
65216
|
-
else if (selection instanceof _graphFrame__WEBPACK_IMPORTED_MODULE_7__.GraphFrame && !this._selectedNodes.length) {
|
|
65217
|
-
if (selection.isCollapsed) {
|
|
65218
|
-
if (this._ctrlKeyIsPressed || forceKeepSelection) {
|
|
65219
|
-
if (this._selectedFrames.indexOf(selection) === -1) {
|
|
65220
|
-
this._selectedFrames.push(selection);
|
|
65221
|
-
}
|
|
65222
|
-
}
|
|
65223
|
-
else {
|
|
65224
|
-
this._selectedFrames = [selection];
|
|
65225
|
-
this._selectedNodes = [];
|
|
65226
|
-
this._selectedLink = null;
|
|
65227
|
-
this._selectedPort = null;
|
|
65228
|
-
}
|
|
65229
|
-
}
|
|
65230
|
-
else {
|
|
65231
|
-
this._selectedNodes = [];
|
|
65232
|
-
this._selectedFrames = [selection];
|
|
65233
|
-
this._selectedLink = null;
|
|
65234
|
-
this._selectedPort = null;
|
|
65235
|
-
}
|
|
65236
|
-
}
|
|
65237
|
-
else if (selection instanceof _graphNode__WEBPACK_IMPORTED_MODULE_3__.GraphNode) {
|
|
65238
|
-
if (this._ctrlKeyIsPressed || forceKeepSelection) {
|
|
65239
|
-
if (this._selectedNodes.indexOf(selection) === -1) {
|
|
65240
|
-
this._selectedNodes.push(selection);
|
|
65241
|
-
this._selectedFrames = [];
|
|
65242
|
-
}
|
|
65243
|
-
}
|
|
65244
|
-
else {
|
|
65245
|
-
this._selectedNodes = [selection];
|
|
65246
|
-
this._selectedFrames = [];
|
|
65247
|
-
this._selectedLink = null;
|
|
65248
|
-
this._selectedPort = null;
|
|
65249
|
-
}
|
|
65250
|
-
}
|
|
65251
65216
|
else if (selection instanceof _nodePort__WEBPACK_IMPORTED_MODULE_6__.NodePort) {
|
|
65252
65217
|
this._selectedNodes = [];
|
|
65253
65218
|
this._selectedFrames = [];
|
|
@@ -65260,6 +65225,57 @@ class GraphCanvasComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
|
65260
65225
|
this._selectedLink = null;
|
|
65261
65226
|
this._selectedPort = selection.port;
|
|
65262
65227
|
}
|
|
65228
|
+
else if (selection instanceof _graphNode__WEBPACK_IMPORTED_MODULE_3__.GraphNode || selection instanceof _graphFrame__WEBPACK_IMPORTED_MODULE_7__.GraphFrame) {
|
|
65229
|
+
// If in marquee selection mode, always prioritize selecting nodes. Otherwise, always prioritize selecting the type of
|
|
65230
|
+
// the selected element
|
|
65231
|
+
if (marqueeSelection) {
|
|
65232
|
+
if (selection instanceof _graphFrame__WEBPACK_IMPORTED_MODULE_7__.GraphFrame && !this._selectedFrames.includes(selection)) {
|
|
65233
|
+
this._selectedFrames.push(selection);
|
|
65234
|
+
}
|
|
65235
|
+
else if (selection instanceof _graphNode__WEBPACK_IMPORTED_MODULE_3__.GraphNode && !this._selectedNodes.includes(selection)) {
|
|
65236
|
+
this._selectedNodes.push(selection);
|
|
65237
|
+
}
|
|
65238
|
+
if (this._selectedFrameAndNodesConflict(this.selectedFrames, this.selectedNodes)) {
|
|
65239
|
+
const framesToRemove = new Set();
|
|
65240
|
+
for (const selectedNode of this._selectedNodes) {
|
|
65241
|
+
for (const selectedFrame of this._selectedFrames) {
|
|
65242
|
+
if (selectedFrame.nodes.includes(selectedNode)) {
|
|
65243
|
+
framesToRemove.add(selectedFrame);
|
|
65244
|
+
}
|
|
65245
|
+
}
|
|
65246
|
+
}
|
|
65247
|
+
this._selectedFrames = this._selectedFrames.filter((f) => !framesToRemove.has(f));
|
|
65248
|
+
}
|
|
65249
|
+
}
|
|
65250
|
+
else {
|
|
65251
|
+
if (selection instanceof _graphFrame__WEBPACK_IMPORTED_MODULE_7__.GraphFrame) {
|
|
65252
|
+
if (this._ctrlKeyIsPressed || forceKeepSelection) {
|
|
65253
|
+
if (!this._selectedFrameAndNodesConflict([selection], this._selectedNodes) && !this._selectedFrames.includes(selection)) {
|
|
65254
|
+
this._selectedFrames.push(selection);
|
|
65255
|
+
}
|
|
65256
|
+
}
|
|
65257
|
+
else {
|
|
65258
|
+
this._selectedFrames = [selection];
|
|
65259
|
+
this._selectedNodes = [];
|
|
65260
|
+
this._selectedLink = null;
|
|
65261
|
+
this._selectedPort = null;
|
|
65262
|
+
}
|
|
65263
|
+
}
|
|
65264
|
+
else if (selection instanceof _graphNode__WEBPACK_IMPORTED_MODULE_3__.GraphNode) {
|
|
65265
|
+
if (this._ctrlKeyIsPressed || forceKeepSelection) {
|
|
65266
|
+
if (!this._selectedFrameAndNodesConflict(this._selectedFrames, [selection]) && !this._selectedNodes.includes(selection)) {
|
|
65267
|
+
this._selectedNodes.push(selection);
|
|
65268
|
+
}
|
|
65269
|
+
}
|
|
65270
|
+
else {
|
|
65271
|
+
this._selectedFrames = [];
|
|
65272
|
+
this._selectedNodes = [selection];
|
|
65273
|
+
this._selectedLink = null;
|
|
65274
|
+
this._selectedPort = null;
|
|
65275
|
+
}
|
|
65276
|
+
}
|
|
65277
|
+
}
|
|
65278
|
+
}
|
|
65263
65279
|
}
|
|
65264
65280
|
});
|
|
65265
65281
|
props.globalState.onCandidatePortSelectedObservable.add((port) => {
|
|
@@ -65363,6 +65379,17 @@ class GraphCanvasComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
|
65363
65379
|
get frameContainer() {
|
|
65364
65380
|
return this._frameContainer;
|
|
65365
65381
|
}
|
|
65382
|
+
// There is a selection conflict between nodes and frames if any selected node is inside any selected frame
|
|
65383
|
+
_selectedFrameAndNodesConflict(frameSelection, nodeSelection) {
|
|
65384
|
+
for (const frame of frameSelection) {
|
|
65385
|
+
for (const node of nodeSelection) {
|
|
65386
|
+
if (frame.nodes.includes(node)) {
|
|
65387
|
+
return true;
|
|
65388
|
+
}
|
|
65389
|
+
}
|
|
65390
|
+
}
|
|
65391
|
+
return false;
|
|
65392
|
+
}
|
|
65366
65393
|
getGridPosition(position, useCeil = false) {
|
|
65367
65394
|
const gridSize = this.gridSize;
|
|
65368
65395
|
if (gridSize === 0) {
|
|
@@ -66581,7 +66608,7 @@ class GraphFrame {
|
|
|
66581
66608
|
const rect2 = this.element.getBoundingClientRect();
|
|
66582
66609
|
const overlap = !(rect1.right < rect2.left || rect1.left > rect2.right || rect1.bottom < rect2.top || rect1.top > rect2.bottom);
|
|
66583
66610
|
if (overlap) {
|
|
66584
|
-
canvas.globalState.onSelectionChangedObservable.notifyObservers({ selection: this, forceKeepSelection: true });
|
|
66611
|
+
canvas.globalState.onSelectionChangedObservable.notifyObservers({ selection: this, forceKeepSelection: true, marqueeSelection: true });
|
|
66585
66612
|
}
|
|
66586
66613
|
});
|
|
66587
66614
|
this._onGraphNodeRemovalObserver = canvas.globalState.onGraphNodeRemovalObservable.add((node) => {
|
|
@@ -67416,7 +67443,7 @@ class GraphNode {
|
|
|
67416
67443
|
this._onSelectionBoxMovedObserver = this._globalState.onSelectionBoxMoved.add((rect1) => {
|
|
67417
67444
|
const rect2 = this._visual.getBoundingClientRect();
|
|
67418
67445
|
const overlap = !(rect1.right < rect2.left || rect1.left > rect2.right || rect1.bottom < rect2.top || rect1.top > rect2.bottom);
|
|
67419
|
-
this.
|
|
67446
|
+
this.setIsSelected(overlap, true);
|
|
67420
67447
|
});
|
|
67421
67448
|
this._onFrameCreatedObserver = this._globalState.onFrameCreatedObservable.add((frame) => {
|
|
67422
67449
|
if (this._ownerCanvas.frames.some((f) => f.nodes.indexOf(this) !== -1)) {
|
|
@@ -67514,6 +67541,9 @@ class GraphNode {
|
|
|
67514
67541
|
this._enclosingFrameId = value;
|
|
67515
67542
|
}
|
|
67516
67543
|
set isSelected(value) {
|
|
67544
|
+
this.setIsSelected(value, false);
|
|
67545
|
+
}
|
|
67546
|
+
setIsSelected(value, marqueeSelection) {
|
|
67517
67547
|
if (this._isSelected === value) {
|
|
67518
67548
|
return;
|
|
67519
67549
|
}
|
|
@@ -67526,7 +67556,7 @@ class GraphNode {
|
|
|
67526
67556
|
}
|
|
67527
67557
|
}
|
|
67528
67558
|
else {
|
|
67529
|
-
this._globalState.onSelectionChangedObservable.notifyObservers({ selection: this });
|
|
67559
|
+
this._globalState.onSelectionChangedObservable.notifyObservers({ selection: this, marqueeSelection });
|
|
67530
67560
|
}
|
|
67531
67561
|
}
|
|
67532
67562
|
isOverlappingFrame(frame) {
|
|
@@ -67622,7 +67652,7 @@ class GraphNode {
|
|
|
67622
67652
|
this._globalState.onSelectionChangedObservable.notifyObservers({ selection: this });
|
|
67623
67653
|
}
|
|
67624
67654
|
else if (evt.ctrlKey) {
|
|
67625
|
-
this.
|
|
67655
|
+
this.setIsSelected(false, false);
|
|
67626
67656
|
}
|
|
67627
67657
|
evt.stopPropagation();
|
|
67628
67658
|
for (const selectedNode of this._ownerCanvas.selectedNodes) {
|
|
@@ -67775,10 +67805,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
67775
67805
|
/* harmony export */ "NodeLink": () => (/* binding */ NodeLink)
|
|
67776
67806
|
/* harmony export */ });
|
|
67777
67807
|
/* harmony import */ var _graphCanvas__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./graphCanvas */ "../../../tools/nodeEditor/dist/diagram/graphCanvas.js");
|
|
67778
|
-
/* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/
|
|
67808
|
+
/* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes */ "core/Misc/dataStorage");
|
|
67779
67809
|
/* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__);
|
|
67780
67810
|
|
|
67781
67811
|
|
|
67812
|
+
|
|
67782
67813
|
class NodeLink {
|
|
67783
67814
|
constructor(graphCanvas, portA, nodeA, portB, nodeB) {
|
|
67784
67815
|
this._isVisible = true;
|
|
@@ -67872,13 +67903,16 @@ class NodeLink {
|
|
|
67872
67903
|
}
|
|
67873
67904
|
onClick(evt) {
|
|
67874
67905
|
if (evt.altKey) {
|
|
67906
|
+
const nodeA = this._nodeA;
|
|
67907
|
+
const pointA = this._portA.connectionPoint;
|
|
67908
|
+
const nodeB = this._nodeB;
|
|
67909
|
+
const pointB = this._portB.connectionPoint;
|
|
67910
|
+
if (pointA.type === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.NodeMaterialBlockConnectionPointTypes.Object || pointB.type === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.NodeMaterialBlockConnectionPointTypes.Object) {
|
|
67911
|
+
return; // We do not support Elbow on complex types
|
|
67912
|
+
}
|
|
67875
67913
|
// Create an elbow at the clicked location
|
|
67876
67914
|
this._graphCanvas.globalState.onNewNodeCreatedObservable.addOnce((newNode) => {
|
|
67877
67915
|
const newElbowBlock = newNode.block;
|
|
67878
|
-
const nodeA = this._nodeA;
|
|
67879
|
-
const pointA = this._portA.connectionPoint;
|
|
67880
|
-
const nodeB = this._nodeB;
|
|
67881
|
-
const pointB = this._portB.connectionPoint;
|
|
67882
67916
|
// Delete previous link
|
|
67883
67917
|
this.dispose();
|
|
67884
67918
|
// Connect to Elbow block
|