aboutsummaryrefslogtreecommitdiff
path: root/features/hud
diff options
context:
space:
mode:
Diffstat (limited to 'features/hud')
-rw-r--r--features/hud/HudTextElement.js18
-rw-r--r--features/hud/index.js4
2 files changed, 18 insertions, 4 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()
diff --git a/features/hud/index.js b/features/hud/index.js
index 7d0d6ca..b8aa9cb 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -128,14 +128,14 @@ class Hud extends Feature {
.requires(this.showSpotifyPlaying)
.editTempText("&6Spotify&7> &cNot open"))
this.hudElements.push(this.spotifyElement)
- this.spotifyElement2 = new HudTextElement().setToggleSetting(this.showSpotifyPlaying).setLocationSetting({
+ this.spotifyElement2 = new HudTextElement().setLocationSetting({
setParent: () => { },
x: this.spotifyElement.locationSetting.x + this.spotifyElement.getWidth(),
y: this.spotifyElement.locationSetting.y,
scale: this.spotifyElement.locationSetting.scale,
shadowType: this.spotifyElement.locationSetting.shadowType
})
- this.spotifyElement2.renderElm.stopRender()
+ this.spotifyElement2.disableRendering()
this.showLobbyDay = new ToggleSetting("Show Current Lobby Day", "", true, "lobby_day", this)
this.lobbyDayElement = new HudTextElement()