Kaynağa Gözat

Fix nme grid alignement

David Catuhe 5 yıl önce
ebeveyn
işleme
7ed5d2f18c

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
dist/preview release/babylon.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 7 - 7
dist/preview release/babylon.max.js


+ 1 - 1
dist/preview release/nodeEditor/babylon.nodeEditor.d.ts

@@ -951,7 +951,7 @@ declare module NODEEDITOR {
         private _refreshLinks;
         refresh(): void;
         private _onDown;
-        cleanAccumulation(): void;
+        cleanAccumulation(reset?: boolean): void;
         private _onUp;
         private _onMove;
         renderProperties(): BABYLON.Nullable<JSX.Element>;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
dist/preview release/nodeEditor/babylon.nodeEditor.js


+ 16 - 7
dist/preview release/nodeEditor/babylon.nodeEditor.max.js

@@ -54529,9 +54529,9 @@ var GraphNode = /** @class */ (function () {
             return this._x;
         },
         set: function (value) {
-            if (this._x === value) {
-                return;
-            }
+            // if (this._x === value) {
+            //     return;
+            // }
             this._x = value;
             this._gridAlignedX = this._ownerCanvas.getGridPosition(value);
             this._visual.style.left = this._gridAlignedX + "px";
@@ -54546,9 +54546,9 @@ var GraphNode = /** @class */ (function () {
             return this._y;
         },
         set: function (value) {
-            if (this._y === value) {
-                return;
-            }
+            // if (this._y === value) {
+            //     return;
+            // }
             this._y = value;
             this._gridAlignedY = this._ownerCanvas.getGridPosition(value);
             this._visual.style.top = this._gridAlignedY + "px";
@@ -54691,11 +54691,20 @@ var GraphNode = /** @class */ (function () {
             this.isSelected = false;
         }
         evt.stopPropagation();
+        for (var _i = 0, _a = this._ownerCanvas.selectedNodes; _i < _a.length; _i++) {
+            var selectedNode = _a[_i];
+            selectedNode.cleanAccumulation(true);
+        }
         this._mouseStartPointX = evt.clientX;
         this._mouseStartPointY = evt.clientY;
         this._visual.setPointerCapture(evt.pointerId);
     };
-    GraphNode.prototype.cleanAccumulation = function () {
+    GraphNode.prototype.cleanAccumulation = function (reset) {
+        if (reset === void 0) { reset = false; }
+        if (reset) {
+            this._x = Number.MIN_VALUE;
+            this._y = Number.MIN_VALUE;
+        }
         this.x = this.gridAlignedX;
         this.y = this.gridAlignedY;
     };

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
dist/preview release/nodeEditor/babylon.nodeEditor.max.js.map


+ 2 - 2
dist/preview release/nodeEditor/babylon.nodeEditor.module.d.ts

@@ -1158,7 +1158,7 @@ declare module "babylonjs-node-editor/diagram/graphNode" {
         private _refreshLinks;
         refresh(): void;
         private _onDown;
-        cleanAccumulation(): void;
+        cleanAccumulation(reset?: boolean): void;
         private _onUp;
         private _onMove;
         renderProperties(): Nullable<JSX.Element>;
@@ -2403,7 +2403,7 @@ declare module NODEEDITOR {
         private _refreshLinks;
         refresh(): void;
         private _onDown;
-        cleanAccumulation(): void;
+        cleanAccumulation(reset?: boolean): void;
         private _onUp;
         private _onMove;
         renderProperties(): BABYLON.Nullable<JSX.Element>;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 3 - 3
dist/preview release/viewer/babylon.viewer.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 10 - 1
nodeEditor/src/diagram/graphNode.ts

@@ -281,13 +281,22 @@ export class GraphNode {
 
         evt.stopPropagation();
 
+        for (var selectedNode of this._ownerCanvas.selectedNodes) {
+            selectedNode.cleanAccumulation(true);
+        }
+
         this._mouseStartPointX = evt.clientX;
         this._mouseStartPointY = evt.clientY;        
         
         this._visual.setPointerCapture(evt.pointerId);
     }
 
-    public cleanAccumulation() {
+    public cleanAccumulation(reset = false) {
+        if (reset) {
+            this._x = Number.MIN_VALUE;
+            this._y = Number.MIN_VALUE;
+        }
+
         this.x = this.gridAlignedX;
         this.y = this.gridAlignedY;
     }