Skip to content

Fix rating arc jumping to 100 when dragging past 0 - #31

Merged
T0liver merged 1 commit into
mainfrom
c-fix-rating-arc-clamp-34a0
Nov 21, 2026
Merged

T0liver merged 1 commit into
mainfrom
c-fix-rating-arc-clamp-34a0

Conversation

@T0liver

@T0liver T0liver commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Cause

RatingArcSlider mapped drag angles with Math.toDegrees(atan2(...)).coerceIn(0.0, 180.0). Below the left end of the arc, atan2 is negative (~-170°); coercing to 0° maps to rating 100, not 0.

Fix

Extracted ratingFromPointer() that uses the arc mapping for angles in [0°, 180°] and, for negative angles (gap below the arc), clamps to 0 or 100 based on whether the pointer is left or right of center.

Tests

Added RatingArcPointerMathTest for arc endpoints, mid-arc, and below-arc left/right gap cases.

Fixes #23

Open in Web Open in Cursor 

Extract pointer-to-rating conversion into ratingFromPointer and clamp
below-arc drags by horizontal side instead of coercing negative angles to 0°.

Co-authored-by: T0liver <T0liver@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Test Results

8 tests  +7   8 ✅ +7   0s ⏱️ ±0s
2 suites +1   0 💤 ±0 
2 files   +1   0 ❌ ±0 

Results for commit 9f851e7. ± Comparison against base commit c865cc7.

@T0liver
T0liver merged commit e01e892 into main Nov 21, 2026
4 checks passed
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.

[Automated test] Rating arc: dragging past 0 jumps the value to 100

2 participants