-
Notifications
You must be signed in to change notification settings - Fork 121
Fix scalebar ornament triggers unnecessary layoutSubviews #507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added log statement to verify that unnecessary layoutSubviews weren't being triggered. Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions that can be addressed if appropriate, but otherwise looks good. Thank you!
toItem:nil | ||
attribute:NSLayoutAttributeNotAnAttribute | ||
multiplier:1 | ||
constant:16]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an existing constant for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relatedBy:NSLayoutRelationEqual | ||
toItem:self | ||
attribute:NSLayoutAttributeWidth | ||
multiplier:.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is half the width of the view essentially the maximum size possible? How does this impact running on iPad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be a bit long on the iPad, but I think it's acceptable 😂
CGFloat barWidth = totalBarWidth/self.bars.count; | ||
|
||
BOOL RTL = [self usesRightToLeftLayout]; | ||
CGFloat halfLabelWidth = ceil(self.lastLabelWidth/2); | ||
CGFloat barOffset = RTL ? halfLabelWidth : 0.0; | ||
|
||
self.containerView.frame = CGRectMake(barOffset, | ||
intrinsicContentHeight - MGLBarHeight, | ||
CGFloat containerViewX = self.isOnScreenRight ? self.bounds.size.width - totalBarWidth - barOffset : barOffset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also need the halfLabelWidth
if on the right hand side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix issue #502