diff options
Diffstat (limited to 'features/hud/HudTextElement.js')
-rw-r--r-- | features/hud/HudTextElement.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index d6440aa..cdde6f3 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -18,9 +18,23 @@ class HudTextElement { this.renderTextCache = [""] this.textChanged = false + this.renderingDisabled = false + this.renderElm = new HudText([""], 0, 0, true).startRender() } + disableRendering() { + this.renderingDisabled = true + this.renderElm.stopRender() + } + + enableRendering() { + this.renderingDisabled = false + if (this.toggleSetting.getValue()) { + this.renderElm.startRender() + } + } + delete() { this.renderElm.stopRender() if (this.locationSetting) this.locationSetting.delete() @@ -48,13 +62,13 @@ class HudTextElement { setToggleSetting(setting) { this.toggleSetting = setting setting.onChange = () => { - if (this.toggleSetting.getValue()) { + if (this.toggleSetting.getValue() && !this.renderingDisabled) { this.renderElm.startRender() } else { this.renderElm.stopRender() } } - if (this.toggleSetting.getValue()) { + if (this.toggleSetting.getValue() && !this.renderingDisabled) { this.renderElm.startRender() } else { this.renderElm.stopRender() |