Update CPSlider.j (fixing bindings for case 'only stop at tick marks'

This fixes bindings to also work when 'only stop at tick marks' is selected; formerly the code would crash silently with `setObjectValue`.
This commit is contained in:
Michael Bach
2024-07-16 16:15:57 +02:00
committed by GitHub
parent 688671db6a
commit 58c39c14a5
+3
View File
@@ -312,6 +312,9 @@ var AFFINITY = 5;
if (!trackRect || CGRectIsEmpty(trackRect))
trackRect = bounds;
[self closestTickMarkValueToValue: [self doubleValue]]; // we only need the side effect …
_currentTickMarkSegment = _closestTickMarkIndex; // … when "Only stop on tick marks" selected
if (_isCircular)
{
var angle = 3 * PI_2 - (1.0 - [self doubleValue] - _minValue) / (_maxValue - _minValue) * PI2,