File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ public class OverlayMenuCell: PagingMenuViewCell {
94
94
95
95
func setFrame( _ menuView: PagingMenuView , maskFrame: CGRect , animated: Bool ) {
96
96
textMaskView. frame = menuView. convert ( maskFrame, to: highlightLabel) . inset ( by: maskInsets)
97
+
98
+ if let expectedOriginX = menuView. getExpectedAlignmentPositionXIfNeeded ( ) {
99
+ textMaskView. frame. origin. x += expectedOriginX
100
+ }
97
101
}
98
102
99
103
public func calculateWidth( from height: CGFloat , title: String ) -> CGFloat {
Original file line number Diff line number Diff line change @@ -652,12 +652,23 @@ open class PagingMenuView: UIScrollView {
652
652
653
653
/// If contentSize.width is not over safe area, paging menu view applys cellAlignment to each the cells.
654
654
private func alignContainerViewIfNeeded( ) {
655
- let expectedOriginX = cellAlignment. calculateOriginX ( from: maxSafedOffset)
656
- guard !hasScrollableArea && expectedOriginX != containerView. frame. origin. x else {
655
+ guard let expectedOriginX = getExpectedAlignmentPositionXIfNeeded ( ) else {
657
656
return
658
657
}
659
-
660
- containerView. frame. origin. x = expectedOriginX
658
+
659
+ if expectedOriginX != containerView. frame. origin. x {
660
+ containerView. frame. origin. x = expectedOriginX
661
+ }
662
+ }
663
+
664
+
665
+ /// get correct origin X of menu view's container view, If menu view is scrollable.
666
+ func getExpectedAlignmentPositionXIfNeeded( ) -> CGFloat ? {
667
+ let expectedOriginX = cellAlignment. calculateOriginX ( from: maxSafedOffset)
668
+ guard !hasScrollableArea else {
669
+ return nil
670
+ }
671
+ return expectedOriginX
661
672
}
662
673
663
674
You can’t perform that action at this time.
0 commit comments