Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit d304ac1

Browse files
Nobodymaterial-automation
authored andcommitted
There are two separate systems trying to manage touch events on the MDCButton. First, the button itself uses its standard UIControl event infrastructure to trigger ink ripples. Second, an external MDCInkTouchController attaches its own gesture recognizers to do the same thing. This creates a conflict where both systems respond to the same touch, causing two ink animations to be created and displayed simultaneously, which results...
PiperOrigin-RevId: 769464891
1 parent b2d48fc commit d304ac1

File tree

4 files changed

+1
-46
lines changed

4 files changed

+1
-46
lines changed

components/Ink/src/MDCInkView.m

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ @interface MDCInkView () <CALayerDelegate, MDCInkLayerDelegate, MDCLegacyInkLaye
4343

4444
@end
4545

46-
@implementation MDCInkView {
47-
BOOL _isActiveInkLayerAnimationRunning;
48-
}
46+
@implementation MDCInkView
4947

5048
+ (Class)layerClass {
5149
return [MDCLegacyInkLayer class];
@@ -181,13 +179,6 @@ - (void)startTouchBeganAtPoint:(CGPoint)point
181179
if (self.usesLegacyInkRipple) {
182180
[self.inkLayer spreadFromPoint:point completion:completionBlock];
183181
} else {
184-
@synchronized(self) {
185-
if (animated && _isActiveInkLayerAnimationRunning) {
186-
// Only one ink layer animation can be running at a time.
187-
return;
188-
}
189-
_isActiveInkLayerAnimationRunning = YES;
190-
}
191182
self.startInkRippleCompletionBlock = completionBlock;
192183
MDCInkLayer *inkLayer = [MDCInkLayer layer];
193184
inkLayer.inkColor = self.inkColor;
@@ -286,14 +277,6 @@ - (void)inkLayerAnimationDidStart:(MDCInkLayer *)inkLayer {
286277
}
287278
}
288279

289-
- (void)inkLayerStartAnimationDidFinish:(MDCInkLayer *)inkLayer {
290-
@synchronized(self) {
291-
if (self.activeInkLayer == inkLayer && _isActiveInkLayerAnimationRunning) {
292-
_isActiveInkLayerAnimationRunning = NO;
293-
}
294-
}
295-
}
296-
297280
- (void)inkLayerAnimationDidEnd:(MDCInkLayer *)inkLayer {
298281
if (self.activeInkLayer == inkLayer && self.endInkRippleCompletionBlock) {
299282
self.endInkRippleCompletionBlock();

components/Ink/src/private/MDCInkLayer.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ - (void)startInkAtPoint:(CGPoint)point animated:(BOOL)animated {
165165
animGroup.removedOnCompletion = NO;
166166
[CATransaction setCompletionBlock:^{
167167
self->_startAnimationActive = NO;
168-
if ([self.animationDelegate respondsToSelector:@selector(inkLayerStartAnimationDidFinish:)]) {
169-
[self.animationDelegate inkLayerStartAnimationDidFinish:self];
170-
}
171168
}];
172169
[self addAnimation:animGroup forKey:nil];
173170
[CATransaction commit];

components/Ink/src/private/MDCInkLayerDelegate.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ NS_SWIFT_UI_ACTOR
3838
*/
3939
- (void)inkLayerAnimationDidStart:(nonnull MDCInkLayer *)inkLayer;
4040

41-
/**
42-
Called when the ink ripple appearing animation: scale up, reposition and fade in animation,
43-
finishes.
44-
*/
45-
- (void)inkLayerStartAnimationDidFinish:(nonnull MDCInkLayer *)inkLayer;
46-
4741
/**
4842
Called when the ink ripple animation ends.
4943

components/Ink/tests/unit/MDCInkViewTests.m

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -164,23 +164,4 @@ - (void)testInkViewLayerDoesntMaskToBoundsWithInkStyleUnbounded {
164164
XCTAssertFalse(masksToBoundsWhenUnbounded);
165165
}
166166

167-
- (void)testStartTouchBeganAtPointAddsInkLayerWithAnimationIsIdempotent {
168-
// Given
169-
MDCInkView *testInkView = [[MDCInkView alloc] init];
170-
testInkView.usesLegacyInkRipple = NO;
171-
172-
// Verifies that only one ink animation layer is added, even with concurrent triggers.
173-
// The initial sublayer count is 1 due to the button's default shape-drawing layer.
174-
// After adding the ink layer via startTouchBeganAtPoint:, the count must be 2.
175-
// This assertion ensures subsequent calls do not erroneously add more layers.
176-
[testInkView startTouchBeganAtPoint:CGPointZero animated:YES withCompletion:nil];
177-
[testInkView startTouchBeganAtPoint:CGPointZero animated:YES withCompletion:nil];
178-
179-
XCTAssertEqual(testInkView.layer.sublayers.count, 2);
180-
181-
// Verifies that the ink layer is removed when cancelAllAnimationsAnimated:NO is called.
182-
[testInkView cancelAllAnimationsAnimated:NO];
183-
XCTAssertEqual(testInkView.layer.sublayers.count, 1);
184-
}
185-
186167
@end

0 commit comments

Comments
 (0)