Fix bugs in NumberStepper

This commit is contained in:
redphx 2024-10-29 20:20:34 +07:00
parent 4217b89194
commit b170b95145
2 changed files with 3 additions and 7 deletions

View File

@ -239,7 +239,7 @@ export class NavigationDialogManager {
} else if (keyCode === 'Enter' || keyCode === 'NumpadEnter' || keyCode === 'Space') {
if (!($target instanceof HTMLInputElement && $target.type === 'text')) {
handled = true;
$target.dispatchEvent(new MouseEvent('click'));
$target.dispatchEvent(new MouseEvent('click', {bubbles: true}));
}
} else if (keyCode === 'Escape') {
handled = true;
@ -366,7 +366,7 @@ export class NavigationDialogManager {
}
if (releasedButton === GamepadKey.A) {
document.activeElement && document.activeElement.dispatchEvent(new MouseEvent('click'));
document.activeElement && document.activeElement.dispatchEvent(new MouseEvent('click', {bubbles: true}));
return;
} else if (releasedButton === GamepadKey.B) {
this.hide();

View File

@ -168,7 +168,6 @@ export class SettingElement {
let isHolding = false;
const clearIntervalId = () => {
console.log('clearIntervalId');
intervalId && clearInterval(intervalId);
intervalId = null;
}
@ -287,7 +286,6 @@ export class SettingElement {
updateButtonsVisibility();
const buttonPressed = (e: Event, $btn: HTMLElement) => {
console.log('changeValue');
let value = parseInt(controlValue);
const btnType = $btn.dataset.type;
@ -312,7 +310,6 @@ export class SettingElement {
return;
}
console.log('click');
const $btn = (e.target as HTMLElement).closest('button') as HTMLElement;
$btn && buttonPressed(e, $btn);
@ -321,7 +318,6 @@ export class SettingElement {
};
const onPointerDown = (e: PointerEvent) => {
console.log('down');
clearIntervalId();
const $btn = (e.target as HTMLElement).closest('button') as HTMLElement;
@ -357,7 +353,7 @@ export class SettingElement {
$wrapper.addEventListener('pointerdown', onPointerDown);
$wrapper.addEventListener('contextmenu', onContextMenu);
setNearby($wrapper, {
focus: $range || $btnInc,
focus: options.hideSlider ? $btnInc : $range,
})
return $wrapper;