diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-01-29 06:56:21 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-01-29 06:56:21 +0800 |
commit | 42b7d4ff248e3832c792d37034fad076861dac28 (patch) | |
tree | 62d9bcc1e3525d3721d606a0960521c8e5fee2a5 /features/hud | |
parent | dc4a2cb096b3fd7ddb7d133853f6a5436026b2ca (diff) | |
download | SoopyV2-42b7d4ff248e3832c792d37034fad076861dac28.tar.gz SoopyV2-42b7d4ff248e3832c792d37034fad076861dac28.tar.bz2 SoopyV2-42b7d4ff248e3832c792d37034fad076861dac28.zip |
blaze solver + make spotify box go to width of the max scroll + normalise text on spotify overlay so it doesent render an invalid caracter when the text has a dialect or something
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(){ |