Skip to content

Commit

Permalink
[private/ThumbTrack] Remove ability for thumb view to grow while drag…
Browse files Browse the repository at this point in the history
…ging.

PiperOrigin-RevId: 332327230
  • Loading branch information
bryanoltman authored and material-automation committed Sep 17, 2020
1 parent 2a13da0 commit 39af711
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
1 change: 0 additions & 1 deletion components/Slider/src/MDCSlider.m
Expand Up @@ -74,7 +74,6 @@ - (void)commonMDCSliderInit {
_thumbTrack.thumbRadius = kSliderDefaultThumbRadius;
_thumbTrack.thumbIsSmallerWhenDisabled = YES;
_thumbTrack.thumbIsHollowAtStart = YES;
_thumbTrack.thumbGrowsWhenDragging = YES;
_thumbTrack.shouldDisplayInk = NO;
_thumbTrack.shouldDisplayRipple = YES;
_thumbTrack.discreteDotVisibility = MDCThumbDiscreteDotVisibilityWhenDragging;
Expand Down
3 changes: 0 additions & 3 deletions components/private/ThumbTrack/src/MDCThumbTrack.h
Expand Up @@ -176,9 +176,6 @@ typedef NS_ENUM(NSUInteger, MDCThumbDiscreteDotVisibility) {
*/
@property(nonatomic, assign) BOOL thumbIsHollowAtStart;

/** Whether or not the thumb should grow when the user is dragging it. Default is NO. */
@property(nonatomic, assign) BOOL thumbGrowsWhenDragging;

/** The max radius of the ripple when the user touches the thumb. */
@property(nonatomic, assign) CGFloat thumbRippleMaximumRadius;

Expand Down
14 changes: 3 additions & 11 deletions components/private/ThumbTrack/src/MDCThumbTrack.m
Expand Up @@ -916,15 +916,7 @@ - (void)updateViewsForThumbAfterMoveIsAnimated:(BOOL)animated
_thumbView.borderColor = _trackOffColor;
}

CGFloat radius;
if (_isDraggingThumb && !_shouldDisplayThumbWithDiscreteValueLabel && _discrete &&
_shouldDisplayDiscreteValueLabel && _numDiscreteValues > 1) {
radius = 0;
} else {
radius = _thumbRadius;
}

if (radius == _thumbView.cornerRadius || !_thumbGrowsWhenDragging) {
if (_thumbRadius == _thumbView.cornerRadius) {
// No need to change anything
return;
}
Expand All @@ -934,13 +926,13 @@ - (void)updateViewsForThumbAfterMoveIsAnimated:(BOOL)animated
anim.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim.fromValue = [NSNumber numberWithDouble:_thumbView.cornerRadius];
anim.toValue = [NSNumber numberWithDouble:radius];
anim.toValue = [NSNumber numberWithDouble:_thumbRadius];
anim.duration = duration;
anim.delegate = self;
anim.removedOnCompletion = NO; // We'll remove it ourselves as the delegate
[_thumbView.layer addAnimation:anim forKey:anim.keyPath];
}
[self setDisplayThumbRadius:radius]; // Updates frame and corner radius
[self setDisplayThumbRadius:_thumbRadius]; // Updates frame and corner radius

[self updateTrackMask];
}
Expand Down

0 comments on commit 39af711

Please sign in to comment.