Skip to content

Keep the knob from jumping between min and max mid-drag - #792

Open
Gjuju wants to merge 1 commit into
moode-player:developfrom
Gjuju:contrib/knob-no-wrap
Open

Keep the knob from jumping between min and max mid-drag#792
Gjuju wants to merge 1 commit into
moode-player:developfrom
Gjuju:contrib/knob-no-wrap

Conversation

@Gjuju

@Gjuju Gjuju commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

xy2val() recomputes the value from the absolute pointer angle on every move, so
crossing 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 easily
while 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:

pointer (° from 12 o'clock) 168 176 179 181 190 200
before 99 100 100 0 0 3
after 99 100 100 100 100 100

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

@Gjuju
Gjuju force-pushed the contrib/knob-no-wrap branch from 9ae02d2 to c958d36 Compare September 8, 2026 07:44
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
Gjuju force-pushed the contrib/knob-no-wrap branch from c958d36 to e8a4d17 Compare September 9, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant