diff --git a/resources/lang/en.json b/resources/lang/en.json index 46e49b848..664828bf9 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -944,6 +944,10 @@ "name_cull_desc": "Hide names smaller than this size", "hover_fade_label": "Name opacity under cursor", "hover_fade_desc": "How visible names are while your cursor is over them (1 to disable fading)", + "hover_glow_width_label": "Hover glow size", + "hover_glow_width_desc": "How far the white glow extends behind the hovered player's name", + "hover_glow_alpha_label": "Hover glow strength", + "hover_glow_alpha_desc": "How bright the white glow behind the hovered player's name is (0 to disable)", "colored_names_label": "Name color", "colored_names_desc": "Show player names in their player color or in black", "colored": "Colored", diff --git a/src/client/hud/layers/GraphicsSettingsModal.ts b/src/client/hud/layers/GraphicsSettingsModal.ts index c5aff6ae9..b41842be6 100644 --- a/src/client/hud/layers/GraphicsSettingsModal.ts +++ b/src/client/hud/layers/GraphicsSettingsModal.ts @@ -24,6 +24,14 @@ const HOVER_FADE_MIN = 0; const HOVER_FADE_MAX = 1; const HOVER_FADE_STEP = 0.05; +const HOVER_GLOW_WIDTH_MIN = 0; +const HOVER_GLOW_WIDTH_MAX = 8; +const HOVER_GLOW_WIDTH_STEP = 0.5; + +const HOVER_GLOW_ALPHA_MIN = 0; +const HOVER_GLOW_ALPHA_MAX = 1; +const HOVER_GLOW_ALPHA_STEP = 0.05; + const HIGHLIGHT_FILL_MIN = 0; const HIGHLIGHT_FILL_MAX = 1; const HIGHLIGHT_FILL_STEP = 0.01; @@ -159,6 +167,20 @@ export class GraphicsSettingsModal extends LitElement implements Controller { ); } + private currentHoverGlowWidth(): number { + return ( + this.userSettings.graphicsOverrides().name?.hoverGlowWidth ?? + renderDefaults.name.hoverGlowWidth + ); + } + + private currentHoverGlowAlpha(): number { + return ( + this.userSettings.graphicsOverrides().name?.hoverGlowAlpha ?? + renderDefaults.name.hoverGlowAlpha + ); + } + private patchName(patch: Partial) { const current = this.userSettings.graphicsOverrides(); this.userSettings.setGraphicsOverrides({ @@ -349,6 +371,16 @@ export class GraphicsSettingsModal extends LitElement implements Controller { this.patchName({ hoverFadeAlpha: value }); } + private onHoverGlowWidthChange(event: Event) { + const value = parseFloat((event.target as HTMLInputElement).value); + this.patchName({ hoverGlowWidth: value }); + } + + private onHoverGlowAlphaChange(event: Event) { + const value = parseFloat((event.target as HTMLInputElement).value); + this.patchName({ hoverGlowAlpha: value }); + } + private currentDarkNames(): boolean { return ( this.userSettings.graphicsOverrides().name?.darkNames ?? @@ -371,6 +403,8 @@ export class GraphicsSettingsModal extends LitElement implements Controller { const nameScale = this.currentNameScale(); const nameCull = this.currentNameCull(); const hoverFade = this.currentHoverFade(); + const hoverGlowWidth = this.currentHoverGlowWidth(); + const hoverGlowAlpha = this.currentHoverGlowAlpha(); const namesColored = !this.currentDarkNames(); const classicIcons = this.currentClassicIcons(); const highlightFill = this.currentHighlightFill(); @@ -492,6 +526,56 @@ export class GraphicsSettingsModal extends LitElement implements Controller { +
+
+
+ ${translateText("graphics_setting.hover_glow_width_label")} +
+
+ ${translateText("graphics_setting.hover_glow_width_desc")} +
+ +
+
+ ${hoverGlowWidth.toFixed(1)} +
+
+ +
+
+
+ ${translateText("graphics_setting.hover_glow_alpha_label")} +
+
+ ${translateText("graphics_setting.hover_glow_alpha_desc")} +
+ +
+
+ ${hoverGlowAlpha.toFixed(2)} +
+
+