fix(visualization): stop color range slider growing without bound - #4488
Conversation
Dragging one thumb against the other could leave the slider positions crossed by a subpixel amount, because drag clamping compared screen rects while positions are stored in logical track pixels. The crossed state produced a negative segment width that the browser dropped, the overflowing segments widened the flex track, and the ResizeObserver fed the larger width back into the segments — growing the slider endlessly to the right. Thumb clamping now happens in logical track pixels against the stored position of the other thumb, calculateSliderRangePosition clamps to 0 <= leftEnd <= rightStart <= sliderWidth, and the track segments render from widths clamped to sum exactly to the measured slider width. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR fixes unbounded growth of a color-settings range slider by preventing thumbs from crossing via logical-coordinate clamping and by deriving non-negative segment widths that always sum to the measured track width. ChangesColor slider thumb clamping and segment rendering
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Dragging one thumb against the other could leave the slider positions crossed by a subpixel amount, because drag clamping compared screen rects while positions are stored in logical track pixels. The crossed state produced a negative segment width that the browser dropped, the overflowing segments widened the flex track, and the ResizeObserver fed the larger width back into the segments — growing the slider endlessly to the right.
Thumb clamping now happens in logical track pixels against the stored position of the other thumb, calculateSliderRangePosition clamps to 0 <= leftEnd <= rightStart <= sliderWidth, and the track segments render from widths clamped to sum exactly to the measured slider width.
{Meaningful title}
Please read the CONTRIBUTING.md before opening a PR.
Closes: #
Description
Descriptive pull request text, answering:
Definition of Done
A PR is only ready for merge once all the following acceptance criteria are fulfilled:
Screenshots or gifs
Summary by CodeRabbit