Pārlūkot izejas kodu

Merge pull request #7701 from BabylonJS/master

Nightly
mergify[bot] 5 gadi atpakaļ
vecāks
revīzija
15eb905ac0

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 21 - 21
dist/preview release/babylon.max.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.max.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.max.js.map


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

@@ -194,6 +194,7 @@ declare module NODEEDITOR {
         private _onMove;
         private initResizing;
         private cleanUpResizing;
+        private updateMinHeightWithComments;
         private _onRightHandlePointerDown;
         private _onRightHandlePointerMove;
         private _moveRightHandle;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 2
dist/preview release/nodeEditor/babylon.nodeEditor.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 20 - 9
dist/preview release/nodeEditor/babylon.nodeEditor.max.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/nodeEditor/babylon.nodeEditor.max.js.map


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

@@ -274,6 +274,7 @@ declare module "babylonjs-node-editor/diagram/graphFrame" {
         private _onMove;
         private initResizing;
         private cleanUpResizing;
+        private updateMinHeightWithComments;
         private _onRightHandlePointerDown;
         private _onRightHandlePointerMove;
         private _moveRightHandle;
@@ -1852,6 +1853,7 @@ declare module NODEEDITOR {
         private _onMove;
         private initResizing;
         private cleanUpResizing;
+        private updateMinHeightWithComments;
         private _onRightHandlePointerDown;
         private _onRightHandlePointerMove;
         private _moveRightHandle;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 5 - 5
dist/preview release/viewer/babylon.viewer.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


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

@@ -351,6 +351,7 @@
 - Fix for bug where resizing the bottom of a frame at times will not work for any frame in the graph ([#7377](https://github.com/BabylonJS/Babylon.js/issues/7672))([Kyle Belfort](https://github.com/belfortk))
 - Fix bug in PBR sheen when used with clear coat and no env texture provided ([Popov72](https://github.com/Popov72))
 - Fix for bug where Preview Area pop up does not change background color across windows ([#7377](https://github.com/BabylonJS/Babylon.js/issues/7684))([Kyle Belfort](https://github.com/belfortk))
+- Fix for bug where comments would break out of frames and break resizing of frames ([Kyle Belfort](https://github.com/belfortk))
 
 ## Breaking changes
 

+ 1 - 1
nodeEditor/src/diagram/graphCanvas.scss

@@ -211,7 +211,7 @@
                 display: grid;
                 grid-row: 2;
                 grid-column: 1;
-                padding-left: 10px;
+                padding: 0 10px;
                 font-style: italic;
                 word-wrap: break-word;
             }

+ 21 - 11
nodeEditor/src/diagram/graphFrame.ts

@@ -250,7 +250,7 @@ export class GraphFrame {
             return;
         }
         this._height = value;
-        
+
         var gridAlignedBottom = this._ownerCanvas.getGridPositionCeil(value + this._gridAlignedY);
 
         this.element.style.height = `${gridAlignedBottom - this._gridAlignedY}px`;
@@ -261,18 +261,18 @@ export class GraphFrame {
     }
 
     public set comments(comments: string) {
-        if (comments && comments.length > 0) {
-            this.element.style.gridTemplateRows = "40px 40px calc(100% - 80px)";
+        if (comments && (!this._comments || this._comments.length == 0) && comments.length > 0) {
+            this.element.style.gridTemplateRows = "40px min-content 1fr";
             this._borderElement.style.gridRow = "1 / span 3";
             this._portContainer.style.gridRow = "3";
-            this._commentsElement.style.display = "grid";
-            this._commentsElement.style.gridRow = "2";
-            this._commentsElement.style.gridColumn = "1";
-            this._commentsElement.style.paddingLeft = "10px";
-            this._commentsElement.style.fontStyle = "italic";
-            this._commentsElement.innerText = comments;
+            this._commentsElement.classList.add("has-comments");
+        } else if (comments && comments.length === 0) {
+            this._commentsElement.classList.remove('has-comments')
         }
+        this._commentsElement.innerText = comments;
+        this.height = this._borderElement.offsetHeight;
         this._comments = comments;
+        this.updateMinHeightWithComments();
     }
 
     public constructor(candidate: Nullable<HTMLDivElement>, canvas: GraphCanvasComponent, doNotCaptureNodes = false) {
@@ -529,6 +529,13 @@ export class GraphFrame {
         this.refresh();
     }
 
+    private updateMinHeightWithComments = () => {
+        if (this.comments && this.comments.length > 0) {
+            const minFrameHeightWithComments = this._commentsElement.offsetHeight + 40;
+            this._minFrameHeight = minFrameHeightWithComments;
+        }
+    }
+
     private _onRightHandlePointerDown = (evt: PointerEvent) => {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
@@ -567,7 +574,8 @@ export class GraphFrame {
             this._mouseStartPointX =  x;
             this.element.style.width = `${frameElementWidth + widthModification}px`;
         }
-
+        this.updateMinHeightWithComments();
+        this.height = this._borderElement.offsetHeight;
     }
 
     private _onRightHandlePointerUp = (evt: PointerEvent) => {
@@ -596,7 +604,7 @@ export class GraphFrame {
         this._moveBottomHandle(evt, yLimit);
     }
 
-    private _moveBottomHandle = (evt: PointerEvent, yLimit:number) => {
+    private _moveBottomHandle = (evt: PointerEvent, yLimit: number) => {
         // tslint:disable-next-line: no-this-assignment
         const _this = this;
         if (_this._resizingDirection !== ResizingDirection.Bottom || _this._mouseStartPointX === null || _this._mouseStartPointY === null || evt.clientY < yLimit) {
@@ -663,6 +671,8 @@ export class GraphFrame {
             const frameElementLeft = parseFloat(this.element.style.left.replace("px", ""));
             this.element.style.width = `${frameElementWidth - widthModification}px`;
             this.element.style.left = `${frameElementLeft + widthModification}px`;
+            this.updateMinHeightWithComments();
+            this.height = this._borderElement.offsetHeight;
     }
 
     private _onLeftHandlePointerUp = (evt: PointerEvent) => {