GraphiteEditor / GraphiteEditor/Graphite

JS debugging: dragging the increment mode number field sometimes jumps at the start

Open
#2,807 3 comments 0 reactions 0 assignees View on GitHub
Good First Issue Help Wanted Paper Cut Web
Dominant language
Rust
Stars
27.2k
Forks
1.3k
Avg merge
20h 5m
Merged PRs (30d)
57

Description

This seems to probably happen more commonly in Chrome, and it seems to be harder to reproduce in Firefox (I wasn't able to reproduce it in FF in my testing right now, @0HyperCube mentions in the comments below that he has encountered it in FF). See `NumberInput.svelte`.

When you click and drag a number input field of the increment (not range) style, meaning the kind you can drag infinitely left or right, it will sometimes teleport the value to a wildly different value from the one it started with. This can be reproduced by drawing a rectangle and dragging left and right on its stroke weight parameter in the Properties panel repeatedly in quick, small left and right drags until occasionally it will make a big jump.

I hypothesize this is caused by weirdness in the event ordering and mouse position reporting with the [pointer lock](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) API, and it might be related to the widget being broken in Safari: #2038. I recommend logging the values that are being reported by the API and current state every frame to narrow down when the events occur and produce the discrepancy.

At the 4-second mark in this video, we see it jump from `131.3` to `17.3` immediately when the click-and-drag begins:

https://github.com/user-attachments/assets/61b1b1e6-4560-4555-aac5-f7b54cbfacb9

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.