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

View File

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

View File

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