瀏覽代碼

fix bug where moving collapsed NME frame deletes nodes inside

Kyle Belfort 5 年之前
父節點
當前提交
b9529e16cc
共有 3 個文件被更改,包括 51 次插入3 次删除
  1. 2 0
      dist/preview release/what's new.md
  2. 22 0
      nodeEditor/src/diagram/graphCanvas.scss
  3. 27 3
      nodeEditor/src/diagram/graphFrame.ts

+ 2 - 0
dist/preview release/what's new.md

@@ -24,5 +24,7 @@
 
 - Fix infinite loop in `GlowLayer.unReferenceMeshFromUsingItsOwnMaterial` ([Popov72](https://github.com/Popov72)
 - `QuadraticErrorSimplification` was not exported ([RaananW](https://github.com/Raananw)
+- Fix NME Frames bug where collapsing and moving a frame removed the nodes inside ([Kyle Belfort](https://github.com/belfortk)
+
 
 ## Breaking changes

+ 22 - 0
nodeEditor/src/diagram/graphCanvas.scss

@@ -242,6 +242,10 @@
                     cursor: ew-resize;
                     
                 }
+
+                &.collapsed {
+                    cursor: pointer;
+                }
             }
 
             .top-right-corner-handle{
@@ -374,6 +378,24 @@
                     height: 12px;
                 }
             }
+            
+            &.collapsed{
+                .top-handle, .top-right-corner-handle, .right-handle, .bottom-right-corner-handle, .bottom-handle, .bottom-left-corner-handle, .left-handle, .top-left-corner-handle {
+                    cursor: default;
+                }
+
+                .right-handle, .bottom-handle, .top-right-corner-handle, .bottom-right-corner-handle{
+                    &::after{
+                        cursor: default;
+                    }
+                }
+
+                .left-handle, .top-handle, .top-left-corner-handle, .bottom-left-corner-handle{
+                    &::before{
+                        cursor: default;
+                    }
+                }
+            }
         }
 
         #graph-svg-container {

+ 27 - 3
nodeEditor/src/diagram/graphFrame.ts

@@ -78,7 +78,7 @@ export class GraphFrame {
         port.delegatedPort = localPort;
         this._controlledPorts.push(port);
     }
-   
+
     public set isCollapsed(value: boolean) {
         if (this._isCollapsed === value) {
             return;
@@ -135,7 +135,7 @@ export class GraphFrame {
                     } else {
                         this._createInputPort(port, node);
                     }
-                }               
+                }
             }
         } else {
             this.element.classList.remove("collapsed");
@@ -489,7 +489,7 @@ export class GraphFrame {
         this._ownerCanvas._frameIsMoving = true;
 
         this.move(this._ownerCanvas.getGridPosition(this.x), this._ownerCanvas.getGridPosition(this.y))
-    }    
+    }
 
     public move(newX: number, newY: number, align = true) {
         let oldX = this.x;
@@ -587,6 +587,9 @@ export class GraphFrame {
     private _onRightHandlePointerDown = (evt: PointerEvent) => {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
+        if (_this.isCollapsed) {
+            return;
+        }
         this.initResizing(evt);
         _this._resizingDirection = ResizingDirection.Right;
         _this.mouseXLimit = evt.clientX - (_this.width - _this._minFrameWidth);
@@ -630,6 +633,9 @@ export class GraphFrame {
     private _onBottomHandlePointerDown = (evt: PointerEvent) => {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
+            if (_this.isCollapsed) {
+                return;
+            }
         _this.initResizing(evt);
         _this._resizingDirection = ResizingDirection.Bottom;
         _this._ownerCanvas.hostCanvas.addEventListener("pointermove", _this._onBottomHandlePointerMove);
@@ -671,6 +677,9 @@ export class GraphFrame {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         _this.initResizing(evt);
+        if (_this.isCollapsed) {
+                return;
+            }
         _this._resizingDirection = ResizingDirection.Left;
         _this.mouseXLimit = evt.clientX + _this.width - _this._minFrameWidth;
         _this._ownerCanvas.hostCanvas.addEventListener("pointerup", _this._onLeftHandlePointerUp);
@@ -715,6 +724,9 @@ export class GraphFrame {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         _this.initResizing(evt);
+        if (_this.isCollapsed) {
+                return;
+            }
         _this._resizingDirection = ResizingDirection.Top;
         _this._ownerCanvas.hostCanvas.addEventListener("pointerup", _this._onTopHandlePointerUp);
         _this._ownerCanvas.hostCanvas.addEventListener("pointermove", _this._onTopHandlePointerMove);
@@ -756,6 +768,9 @@ export class GraphFrame {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         _this.initResizing(evt);
+        if (_this.isCollapsed) {
+                return;
+            }
         _this._resizingDirection = ResizingDirection.TopRight;
         _this._ownerCanvas.hostCanvas.addEventListener("pointerup", _this._onTopRightHandlePointerUp);
         _this._ownerCanvas.hostCanvas.addEventListener("pointermove", _this._onTopRightHandlePointerMove);
@@ -814,6 +829,9 @@ export class GraphFrame {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         _this.initResizing(evt);
+        if (_this.isCollapsed) {
+                return;
+            }
         _this._resizingDirection = ResizingDirection.BottomRight;
         _this._ownerCanvas.hostCanvas.addEventListener("pointerup", _this._onBottomRightHandlePointerUp);
         _this._ownerCanvas.hostCanvas.addEventListener("pointermove", _this._onBottomRightHandlePointerMove);
@@ -871,6 +889,9 @@ export class GraphFrame {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         _this.initResizing(evt);
+        if (_this.isCollapsed) {
+                return;
+            }
         _this._resizingDirection = ResizingDirection.BottomLeft;
         _this.mouseXLimit = evt.clientX + _this.width - _this._minFrameWidth;
         _this._ownerCanvas.hostCanvas.addEventListener("pointerup", _this._onBottomLeftHandlePointerUp);
@@ -930,6 +951,9 @@ export class GraphFrame {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         _this.initResizing(evt);
+        if (_this.isCollapsed) {
+                return;
+            }
         _this._resizingDirection = ResizingDirection.TopLeft;
         _this.mouseXLimit = evt.clientX + _this.width - _this._minFrameWidth;
         _this._ownerCanvas.hostCanvas.addEventListener("pointerup", _this._onTopLeftHandlePointerUp);