diff options
Diffstat (limited to 'features/hud/HudTextElement.js')
-rw-r--r-- | features/hud/HudTextElement.js | 19 |
1 files changed, 17 insertions, 2 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 } |