[ios] Fix ornaments' view constraints bug in bold-text mode (#57)
* [ios] fix bold text reset view's bounds issue * [ios]add change log
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.
|
||||
|
||||
## master
|
||||
|
||||
* Fix ornaments' view constraints bug when devices change to bold-text mode. ([#57](https://github.com/mapbox/mapbox-gl-native-ios/pull/57))
|
||||
|
||||
## 5.5.0 - November 5, 2019
|
||||
|
||||
### Performance improvements
|
||||
|
||||
@@ -889,8 +889,11 @@ public:
|
||||
}
|
||||
|
||||
if (!CGSizeEqualToSize(size, CGSizeZero)) {
|
||||
[updatedConstraints addObject:[view.widthAnchor constraintEqualToConstant:size.width]];
|
||||
[updatedConstraints addObject:[view.heightAnchor constraintEqualToConstant:size.height]];
|
||||
NSLayoutConstraint *widthConstraint = [view.widthAnchor constraintEqualToConstant:size.width];
|
||||
widthConstraint.identifier = @"width";
|
||||
NSLayoutConstraint *heightConstraint = [view.heightAnchor constraintEqualToConstant:size.height];
|
||||
heightConstraint.identifier = @"height";
|
||||
[updatedConstraints addObjectsFromArray:@[widthConstraint,heightConstraint]];
|
||||
}
|
||||
|
||||
[NSLayoutConstraint deactivateConstraints:constraints];
|
||||
@@ -912,7 +915,7 @@ public:
|
||||
[self updateConstraintsForOrnament:self.compassView
|
||||
constraints:self.compassViewConstraints
|
||||
position:self.compassViewPosition
|
||||
size:self.compassView.bounds.size
|
||||
size:[self sizeForOrnament:self.compassView constraints:self.compassViewConstraints]
|
||||
margins:self.compassViewMargins];
|
||||
}
|
||||
|
||||
@@ -930,7 +933,7 @@ public:
|
||||
[self updateConstraintsForOrnament:self.logoView
|
||||
constraints:self.logoViewConstraints
|
||||
position:self.logoViewPosition
|
||||
size:self.logoView.bounds.size
|
||||
size:[self sizeForOrnament:self.logoView constraints:self.logoViewConstraints]
|
||||
margins:self.logoViewMargins];
|
||||
}
|
||||
|
||||
@@ -939,10 +942,31 @@ public:
|
||||
[self updateConstraintsForOrnament:self.attributionButton
|
||||
constraints:self.attributionButtonConstraints
|
||||
position:self.attributionButtonPosition
|
||||
size:self.attributionButton.bounds.size
|
||||
size:[self sizeForOrnament:self.attributionButton constraints:self.attributionButtonConstraints]
|
||||
margins:self.attributionButtonMargins];
|
||||
}
|
||||
|
||||
- (CGSize)sizeForOrnament:(UIView *)view
|
||||
constraints:(NSMutableArray *)constraints {
|
||||
// avoid regenerating size constraints
|
||||
CGSize size;
|
||||
if(constraints && constraints.count > 0) {
|
||||
for (NSLayoutConstraint * constraint in constraints) {
|
||||
if([constraint.identifier isEqualToString:@"width"]) {
|
||||
size.width = constraint.constant;
|
||||
}
|
||||
else if ([constraint.identifier isEqualToString:@"height"]) {
|
||||
size.height = constraint.constant;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
size = view.bounds.size;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
- (BOOL)isOpaque
|
||||
{
|
||||
return _opaque;
|
||||
|
||||
Reference in New Issue
Block a user