Browse Source

Fix not required traversal for GUI

David Catuhe 7 năm trước cách đây
mục cha
commit
20e678b930
2 tập tin đã thay đổi với 4 bổ sung6 xóa
  1. 0 6
      gui/src/2D/advancedDynamicTexture.ts
  2. 4 0
      gui/src/2D/controls/control.ts

+ 0 - 6
gui/src/2D/advancedDynamicTexture.ts

@@ -307,12 +307,6 @@ export class AdvancedDynamicTexture extends DynamicTexture {
      */
     public markAsDirty() {
         this._isDirty = true;
-
-        this.executeOnAllControls((control) => {
-            if (control._isFontSizeInPercentage) {
-                control._resetFontCache();
-            }
-        });
     }
 
     /**

+ 4 - 0
gui/src/2D/controls/control.ts

@@ -959,6 +959,10 @@ export class Control {
 
     /** @hidden */
     protected _applyStates(context: CanvasRenderingContext2D): void {
+        if (this._isFontSizeInPercentage) {
+            this._resetFontCache();
+        }
+
         if (this._fontSet) {
             this._prepareFont();
             this._fontSet = false;