fix UI settings a bit

This commit is contained in:
Tamius Han 2026-01-25 21:41:01 +01:00
parent eb89ba03db
commit 2cb6a88c5e
3 changed files with 34 additions and 10 deletions

View File

@ -15,6 +15,8 @@ export class ClientMenu {
private trigger: HTMLDivElement; private trigger: HTMLDivElement;
private visible = false; private visible = false;
private hiddenClass = 'uw-hidden';
private menuPositionClasses: string[] = []; private menuPositionClasses: string[] = [];
@ -314,12 +316,13 @@ export class ClientMenu {
this.onDocumentMouseMove = (e: MouseEvent) => { this.onDocumentMouseMove = (e: MouseEvent) => {
this.lastMouseMove = performance.now(); this.lastMouseMove = performance.now();
if (activationRadius != null) { if (activationRadius) {
if (! menuActivatorRect.width) { if (! menuActivatorRect.width) {
recalculateActivator(); recalculateActivator();
} }
const d = Math.hypot(e.clientX - cx, e.clientY - cy); const d = Math.hypot(e.clientX - cx, e.clientY - cy);
console.log('activator radius:', activationRadius, 'mouse distance:', d);
this.isWithinActivation = d <= activationRadius; this.isWithinActivation = d <= activationRadius;
} else { } else {
@ -384,16 +387,26 @@ export class ClientMenu {
} }
if (options?.forceShow !== undefined) { if (options?.forceShow !== undefined) {
if (!this.forceShow && options.forceShow) {
this.root.classList.add('uw-force-visible');
}
if (this.forceShow && !options.forceShow) {
this.root.classList.remove('uw-force-visible');
}
this.forceShow = options.forceShow; this.forceShow = options.forceShow;
} }
} }
hide(options?: {forceShow?: boolean}) { hide(options?: {forceShow?: boolean}) {
if (options?.forceShow !== undefined) { if (options?.forceShow !== undefined) {
if (this.forceShow !== options.forceShow) {
this.root.classList.remove('uw-force-visible');
this.forceShow = options.forceShow; this.forceShow = options.forceShow;
} }
}
if (this.visible && !this.forceShow) { if (this.visible) {
this.visible = false; this.visible = false;
this.root.classList.remove('uw-visible'); this.root.classList.remove('uw-visible');
this.root.classList.add('uw-hidden'); this.root.classList.add('uw-hidden');

View File

@ -56,7 +56,7 @@
> >
<select <select
class="unit-select !min-w-[72px]" class="unit-select !min-w-[72px]"
v-model="settings.active.ui.inPlayer.activationDistanceUnit" v-model="settings.active.ui.inPlayer.activationDistanceUnits"
@change="(event) => saveSettings(true)" @change="(event) => saveSettings(true)"
> >
<option value="%">%</option> <option value="%">%</option>

View File

@ -8,13 +8,21 @@
transition: opacity 120ms ease; transition: opacity 120ms ease;
&:not(.uw-visible) { &:not(.uw-visible) {
&:not(.uw-force-visible) {
pointer-events: none; pointer-events: none;
opacity: 0; opacity: 0;
} }
}
&.uw-hidden { &.uw-hidden {
&:not(.uw-force-visible) {
pointer-events: none; pointer-events: none;
opacity: 0; opacity: 0;
} }
&.uw-force-visible {
@apply text-blue-500;
opacity: 0.5;
}
}
&.uw-visible { &.uw-visible {
/* pointer-events: auto; */ /* pointer-events: auto; */
opacity: 1; opacity: 1;
@ -68,9 +76,12 @@
} }
.uw-hidden { .uw-hidden {
&:not(.uw-force-visible) {
display: none !important; display: none !important;
} }
}
.uw-trigger, .uw-menu-item, .uw-menu-trigger { .uw-trigger, .uw-menu-item, .uw-menu-trigger {
pointer-events: auto; pointer-events: auto;
} }