Ignore mousemove when just clicking (#4302)

This commit is contained in:
DingDongSoLong4 2023-11-22 00:52:36 +02:00 committed by GitHub
parent b0a34a3dc0
commit 13a24a634d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -220,15 +220,21 @@ export const ScenePlayerScrubber: React.FC<IScenePlayerScrubberProps> = ({
(event: MouseEvent) => {
if (!mouseDown.current) return;
// negative dragging right (past), positive left (future)
const delta = event.clientX - lastMouseEvent.current!.clientX;
if (lastMouseEvent.current === startMouseEvent.current) {
// this is the first mousemove event after mousedown
// #4295: a mousemove with delta 0 can be sent when just clicking
// ignore such an event to prevent pausing the player
if (delta === 0) return;
onScroll();
}
contentEl.current!.classList.add("dragging");
// negative dragging right (past), positive left (future)
const delta = event.clientX - lastMouseEvent.current!.clientX;
const movement = event.movementX;
velocity.current = movement;