FIX: decrease reorder sidebar delay for desktop (#21098)

Delay to reorder links in custom sidebar section doesn't have to be that long for desktop compared to touch screen.
This commit is contained in:
Krzysztof Kotlarek 2023-04-14 12:31:21 +10:00 committed by GitHub
parent 1f0207ba06
commit 933d276b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -3,6 +3,9 @@ import { bind } from "discourse-common/utils/decorators";
import RouteInfoHelper from "discourse/lib/sidebar/route-info-helper";
import discourseLater from "discourse-common/lib/later";
const TOUCH_SCREEN_DELAY = 300;
const MOUSE_DELAY = 100;
export default class SectionLink {
@tracked linkDragCss;
@ -28,9 +31,12 @@ export default class SectionLink {
if (event.button === 0 || event.targetTouches) {
this.startMouseY = this.#calcMouseY(event);
this.willDrag = true;
discourseLater(() => {
this.delayedStart(event);
}, 300);
discourseLater(
() => {
this.delayedStart(event);
},
event.targetTouches ? TOUCH_SCREEN_DELAY : MOUSE_DELAY
);
}
}
delayedStart(event) {