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:
parent
1f0207ba06
commit
933d276b7d
|
@ -3,6 +3,9 @@ import { bind } from "discourse-common/utils/decorators";
|
||||||
import RouteInfoHelper from "discourse/lib/sidebar/route-info-helper";
|
import RouteInfoHelper from "discourse/lib/sidebar/route-info-helper";
|
||||||
import discourseLater from "discourse-common/lib/later";
|
import discourseLater from "discourse-common/lib/later";
|
||||||
|
|
||||||
|
const TOUCH_SCREEN_DELAY = 300;
|
||||||
|
const MOUSE_DELAY = 100;
|
||||||
|
|
||||||
export default class SectionLink {
|
export default class SectionLink {
|
||||||
@tracked linkDragCss;
|
@tracked linkDragCss;
|
||||||
|
|
||||||
|
@ -28,9 +31,12 @@ export default class SectionLink {
|
||||||
if (event.button === 0 || event.targetTouches) {
|
if (event.button === 0 || event.targetTouches) {
|
||||||
this.startMouseY = this.#calcMouseY(event);
|
this.startMouseY = this.#calcMouseY(event);
|
||||||
this.willDrag = true;
|
this.willDrag = true;
|
||||||
discourseLater(() => {
|
discourseLater(
|
||||||
|
() => {
|
||||||
this.delayedStart(event);
|
this.delayedStart(event);
|
||||||
}, 300);
|
},
|
||||||
|
event.targetTouches ? TOUCH_SCREEN_DELAY : MOUSE_DELAY
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delayedStart(event) {
|
delayedStart(event) {
|
||||||
|
|
Loading…
Reference in New Issue