@@ -132,6 +132,7 @@ public struct CompactSlider<Value: BinaryFloatingPoint, Point: CompactSliderPoin
132132 @Environment ( \. compactSliderStyle) var compactSliderStyle
133133 @Environment ( \. compactSliderGridStyle) var compactSliderGridStyle
134134 @Environment ( \. compactSliderCircularGridStyle) var compactSliderCircularGridStyle
135+ @Environment ( \. compactSliderAnimations) var animations
135136
136137 let bounds : ClosedRange < Value >
137138 let pointBounds : ClosedRange < Point >
@@ -190,7 +191,13 @@ public struct CompactSlider<Value: BinaryFloatingPoint, Point: CompactSliderPoin
190191 . dragGesture (
191192 options: options,
192193 onChanged: {
193- isDragging = true
194+ if let animation = animations [ . dragging] {
195+ withAnimation ( animation) {
196+ isDragging = true
197+ }
198+ } else {
199+ isDragging = true
200+ }
194201
195202 if startDragLocation == nil {
196203 startDragLocation = nearestProgressLocation (
@@ -221,7 +228,14 @@ public struct CompactSlider<Value: BinaryFloatingPoint, Point: CompactSliderPoin
221228 }
222229
223230 startDragLocation = nil
224- isDragging = false
231+
232+ if let animation = animations [ . dragging] {
233+ withAnimation ( animation) {
234+ isDragging = false
235+ }
236+ } else {
237+ isDragging = false
238+ }
225239 }
226240 )
227241 #if os(macOS)
@@ -250,7 +264,15 @@ public struct CompactSlider<Value: BinaryFloatingPoint, Point: CompactSliderPoin
250264 }
251265 . opacity ( isEnabled ? 1 : 0.5 )
252266 #if os(macOS) || os(iOS)
253- . onHover { isHovering = isEnabled && $0 }
267+ . onHover { isHovering in
268+ if let animation = animations [ . hovering] {
269+ withAnimation ( animation) {
270+ self . isHovering = isEnabled && isHovering
271+ }
272+ } else {
273+ self . isHovering = isEnabled && isHovering
274+ }
275+ }
254276 #endif
255277 . onChange( of: progress, perform: onProgressesChange)
256278 . onChange ( of: lowerValue, perform: onLowerValueChange)
0 commit comments