diff options
Diffstat (limited to 'features/hud')
| -rw-r--r-- | features/hud/HudTextElement.js | 19 | ||||
| -rw-r--r-- | features/hud/index.js | 3 |
2 files changed, 19 insertions, 3 deletions
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index 5599b5c..8177c43 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -10,9 +10,22 @@ class HudTextElement{ this.editTempTimeV = 0 this.editTempTextV = undefined + this.editBaseWidth = undefined + this.editBaseHeight = undefined + this.tempDisableTime = 0 } + setBaseEditWidth(width){ + this.editBaseWidth = width + return this + } + + setBaseEditHeight(height){ + this.editBaseHeight = height + return this + } + setText(text){ this.text = text @@ -42,10 +55,12 @@ class HudTextElement{ this.renderRaw() } - getWidth(){ + getWidth(locationBox=false){ + if(locationBox && this.editBaseWidth) return this.editBaseWidth return Math.max(...(this.getText()[0].map(a=>Renderer.getStringWidth(ChatLib.removeFormatting(a))))) } - getHeight(){ + getHeight(locationBox=false){ + if(locationBox && this.editBaseHeight) return this.editBaseHeight return 9*this.getText()[0].length } diff --git a/features/hud/index.js b/features/hud/index.js index accd1ef..d256d41 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -113,6 +113,7 @@ class Hud extends Feature { this.showSpotifyPlaying = new ToggleSetting("Show Current Playing Spotify Song", "(Only tested with spotify from windows store)", false, "spotify_now_playing", this) this.spotifyElement = new HudTextElement() .setText("&6Spotify&7> ") + .setBaseEditWidth(Renderer.getStringWidth("Spotify> ")+150) .setToggleSetting(this.showSpotifyPlaying) .setLocationSetting(new LocationSetting("Spotify Location", "Allows you to edit the location of the spotify text", "spotify_now_playing_location", this, [10, 80, 1, 1]) .requires(this.showSpotifyPlaying) @@ -527,7 +528,7 @@ class Hud extends Feature { process.waitFor(); } - this.spotifyElement2.setText(currentSong) + this.spotifyElement2.setText(currentSong.normalize("NFD").replace(/[\u0300-\u036f]/g, "")) } updateHudThingos(){ |
