|
| 1 | +# CompactSlider 2.1.0 Release Notes |
| 2 | + |
| 3 | +## New Features |
| 4 | + |
| 5 | +### Precision Control Option (#33) |
| 6 | +Added a new `.precisionControl` option that enables fine-grained slider adjustments by reducing sensitivity when dragging perpendicular to the slider axis. This is especially useful for precise value adjustments in scenarios like audio mixing, color selection, or parameter tuning. |
| 7 | + |
| 8 | +**Usage:** |
| 9 | +```swift |
| 10 | +// Basic usage with default sensitivity |
| 11 | +CompactSlider(value: $value) |
| 12 | + .compactSliderOptionsByAdding(.precisionControl()) |
| 13 | + |
| 14 | +// Custom sensitivity (50-200 typical range) |
| 15 | +CompactSlider(value: $colorValue, in: 0...255, step: 1) |
| 16 | + .compactSliderOptionsByAdding(.precisionControl(sensitivity: 80)) |
| 17 | +``` |
| 18 | + |
| 19 | +**How it works:** |
| 20 | +- For horizontal sliders: drag up/down while dragging to engage precision mode |
| 21 | +- For vertical sliders: drag left/right while dragging to engage precision mode |
| 22 | +- The further you drag perpendicular to the slider, the more precise the control becomes |
| 23 | +- Sensitivity parameter controls the curve (default: 100.0) |
| 24 | + |
| 25 | +A comprehensive demo showcasing precision control is included in the Demo package. |
| 26 | + |
| 27 | +### Enhanced Scale Customization API (#32) |
| 28 | +Significantly improved the scale customization API to provide more flexibility and control over the default scale appearance. |
| 29 | + |
| 30 | +**New `.compactSliderScale()` method** - Customize the default scale: |
| 31 | +```swift |
| 32 | +CompactSlider(value: $value) |
| 33 | + .compactSliderScale( |
| 34 | + visibility: .always, |
| 35 | + alignment: .top, |
| 36 | + lineLength: 8, |
| 37 | + strokeStyle: .init(lineWidth: 2), |
| 38 | + color: .blue, |
| 39 | + secondaryColor: .blue.opacity(0.3) |
| 40 | + ) |
| 41 | +``` |
| 42 | + |
| 43 | +**Renamed methods for clarity:** |
| 44 | +- `.compactSliderScaleStyles(...)` - For custom scale shape styles (previously `compactSliderScale` with variadic parameters) |
| 45 | +- `.compactSliderScaleView(...)` - For completely custom scale views (previously generic `compactSliderScale`) |
| 46 | + |
| 47 | +This separation makes the API more intuitive and discoverable, allowing users to easily customize the default scale without having to rebuild it from scratch. |
| 48 | + |
| 49 | +## Bug Fixes |
| 50 | + |
| 51 | +### Fixed Progress Range Clamping |
| 52 | +Fixed a rendering issue where sliders would draw beyond their bounds when initialized with values outside the specified range. All progress values are now properly clamped to the 0...1 range during initialization: |
| 53 | +- Single value sliders |
| 54 | +- Multiple value sliders |
| 55 | +- Range sliders |
| 56 | +- Grid sliders |
| 57 | + |
| 58 | +**Example of fixed behavior:** |
| 59 | +```swift |
| 60 | +// Previously: slider would render off-screen |
| 61 | +// Now: value is clamped to maximum (255) |
| 62 | +CompactSlider(value: .constant(300), in: 0...255) |
| 63 | +``` |
| 64 | + |
| 65 | +### Fixed Scale Visibility Issue |
| 66 | +Fixed a bug where calling `.compactSliderScale(visibility: .always)` without providing custom scale styles would incorrectly hide the scale entirely. The scale now correctly respects visibility settings while maintaining the default scale appearance. |
| 67 | + |
| 68 | +## Documentation |
| 69 | + |
| 70 | +Added `CLAUDE.md` - comprehensive development guide for future contributors and AI assistants working with the codebase, including: |
| 71 | +- Build and development commands |
| 72 | +- Architecture overview |
| 73 | +- Key design patterns |
| 74 | +- Component organization |
| 75 | + |
| 76 | +## Related Issues |
| 77 | +- Implements improvements for #33 (Precision control request) |
| 78 | +- Addresses #32 (Scale customization flexibility) |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Migration Notes |
| 83 | + |
| 84 | +### Scale API Changes |
| 85 | +If you were using the generic `compactSliderScale` method for custom views, update to the new method name: |
| 86 | + |
| 87 | +```swift |
| 88 | +// Before: |
| 89 | +.compactSliderScale(visibility: .always) { config in |
| 90 | + MyCustomScaleView(config: config) |
| 91 | +} |
| 92 | + |
| 93 | +// After: |
| 94 | +.compactSliderScaleView(visibility: .always) { config in |
| 95 | + MyCustomScaleView(config: config) |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +If you were using variadic scale shape styles, update to: |
| 100 | +```swift |
| 101 | +// Before: |
| 102 | +.compactSliderScale(visibility: .always, .linear(...), .linear(...)) |
| 103 | + |
| 104 | +// After: |
| 105 | +.compactSliderScaleStyles(visibility: .always, .linear(...), .linear(...)) |
| 106 | +``` |
| 107 | + |
| 108 | +The new `.compactSliderScale()` method (without variadic parameters) is for customizing the default scale appearance. |
0 commit comments