Skip to content

Commit

Permalink
[Dialogs] Fix position of leading/trailing actions in vertical layout
Browse files Browse the repository at this point in the history
When actions are in vertical layout, the first trailing or leading action is incorrectly positioned on top of the second action, instead of above it.
This is fixed by moving the calculations of the y position of the second button after the first button is positioned.

PiperOrigin-RevId: 318979889
  • Loading branch information
galiak11 authored and material-automation committed Jun 30, 2020
1 parent 80685a5 commit 58c4a0e
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1007,15 +1007,13 @@ - (void)layoutVerticalButtons:(NSArray<MDCButton *> *)buttons {
buttonOrigin.x =
self.actionsScrollView.contentSize.width - buttonRect.size.width - actionsInsets.right;
}
buttonOrigin.y += multiplier * buttonRect.size.height;

buttonRect.origin = buttonOrigin;
button.frame = buttonRect;
if (button != buttons.lastObject) {
MDCButton *nextButton = buttons[index + 1];
CGFloat verticalMargin = [self actionsVerticalMarginBetweenTopButton:button
bottomButton:nextButton];
buttonOrigin.y += multiplier * verticalMargin;
buttonOrigin.y += multiplier * (buttonRect.size.height + verticalMargin);
}
}
// Handle RTL
Expand Down

0 comments on commit 58c4a0e

Please sign in to comment.