瀏覽代碼

Fix not required traversal for GUI

David Catuhe 7 年之前
父節點
當前提交
20e678b930
共有 2 個文件被更改,包括 4 次插入6 次删除
  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;