Commit 03115ed1 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Continue tracking pan events after they exit UIControl bounds.

Previously, |-continueTrackingWithTouch:withEvent:|  returned NO when
UIControl.touchInside became NO to short-circuit the tracking event.
However, if the touches continued after this, |-endTrackingWithTouch:
withEvent:| was not called, and the page control can be stuck in an
intermediary state.  This CL updates to continue tracking the pan
after the touch leaves the page control's bounds so that the cleanup
tracking callbacks can be properly received.

Bug: 853634
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I0bfdedabceab824dd6ec4c687e3773fb0f4bcf63
Reviewed-on: https://chromium-review.googlesource.com/1147862
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577539}
parent ec96e9da
......@@ -20,7 +20,7 @@
// Structure of this control:
//
// The page control is similar to a UISegmentedCoffee in appearance, but not in
// The page control is similar to a UISegmentedControl in appearance, but not in
// function. This control doesn't have segments that highlight; instead there
// is a white "slider" that moves across the view onto whichever segment is
// active. Each segment has an image and (optionally) a label. When the slider
......@@ -302,13 +302,11 @@ UIImage* ImageForSegment(NSString* segment, BOOL selected) {
CGPoint position = [touch locationInView:self];
CGFloat deltaX = position.x - self.dragStart.x;
// Convert to position change.
CGFloat postionChange = deltaX / self.sliderRange;
CGFloat positionChange = deltaX / self.sliderRange;
self.sliderPosition = self.dragStartPosition + postionChange;
self.sliderPosition = self.dragStartPosition + positionChange;
[self sendActionsForControlEvents:UIControlEventValueChanged];
// If the touch is now outside of the control, stop tracking it.
return self.touchInside;
return YES;
}
- (void)endTrackingWithTouch:(UITouch*)touch withEvent:(UIEvent*)event {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment