Keep the knob from jumping between min and max mid-drag - #792
Open
Gjuju wants to merge 1 commit into
Open
Conversation
Gjuju
force-pushed
the
contrib/knob-no-wrap
branch
from
September 8, 2026 07:44
9ae02d2 to
c958d36
Compare
The dial computes its value from the absolute pointer angle on every move, so crossing the point where the start and end of the arc meet flips the value from max to min. On the volume knob that seam is a 20 degree gap at the bottom of the dial, easy to cross with a finger. Track the angle across the moves of a single drag and keep the shortest path between two of them, so the value follows the arc and stops at the end instead of wrapping around. A new touch or click still sets the value where it lands. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Gjuju
force-pushed
the
contrib/knob-no-wrap
branch
from
September 9, 2026 17:45
c958d36 to
e8a4d17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
xy2val()recomputes the value from the absolute pointer angle on every move, socrossing the point where the two ends of the arc meet flips the value from max to
min. On the volume knob that seam is the 20° gap at the bottom of the dial
(
angleArc="340" angleOffset="-170"), which a finger or a mouse crosses easilywhile dragging up towards 100. The playback knob has the same seam at 12 o'clock.
This tracks the angle across the moves of a single drag and keeps the shortest
path between two of them, so the value follows the arc and stops at the end
instead of wrapping around. A new touch or click still sets the value where it
lands, and the volume step limiter is unaffected.
Replaying the angle math for a drag up through the bottom of the volume dial:
Caveat: a sweep fast enough to cover more than 180° between two move events would
be read as motion the other way and stop at the end of the arc.
Tested on a local display (touch) and in a desktop browser (mouse).
before
https://judom.duckdns.org/s/zHw5gPW3RGgAY7j
after :
https://judom.duckdns.org/s/wQcWxERpZ2g2ppa