Преглед изворни кода

Merge pull request #8898 from Popov72/master

Fix some GUI problems with padding
sebavan пре 5 година
родитељ
комит
1e3d153d29
2 измењених фајлова са 5 додато и 0 уклоњено
  1. 2 0
      gui/src/2D/controls/container.ts
  2. 3 0
      gui/src/2D/controls/stackPanel.ts

+ 2 - 0
gui/src/2D/controls/container.ts

@@ -340,12 +340,14 @@ export class Container extends Control {
                 }
 
                 if (this.adaptWidthToChildren && computedWidth >= 0) {
+                    computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;
                     if (this.width !== computedWidth + "px") {
                         this.width = computedWidth + "px";
                         this._rebuildLayout = true;
                     }
                 }
                 if (this.adaptHeightToChildren && computedHeight >= 0) {
+                    computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;
                     if (this.height !== computedHeight + "px") {
                         this.height = computedHeight + "px";
                         this._rebuildLayout = true;

+ 3 - 0
gui/src/2D/controls/stackPanel.ts

@@ -158,6 +158,9 @@ export class StackPanel extends Container {
             }
         }
 
+        stackWidth += this.paddingLeftInPixels + this.paddingRightInPixels;
+        stackHeight += this.paddingTopInPixels + this.paddingBottomInPixels;
+
         this._doNotTrackManualChanges = true;
 
         // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.