-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Force camera change when specifying edge padding #14790
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.
Thanks.
LGTM for CHANGELOG commits.
@@ -1311,7 +1311,7 @@ - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(NSEd | |||
} | |||
|
|||
MGLMapCamera *camera = [self cameraForCameraOptions:cameraOptions]; | |||
if ([self.camera isEqualToMapCamera:camera]) { | |||
if ([self.camera isEqualToMapCamera:camera] && NSEdgeInsetsEqual(insets, NSEdgeInsetsZero)) { |
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.
There should be no need for this change: cameraForLatLngBounds is still baking in specified padding
to cameraOptions
adjusted center (that is ##14664 didn't fix cameraForLatLngBounds as we don't have padding in public MGLMapCamera API - padding is in view) and this should keep current behaviour since it is unchanged.
@@ -1198,7 +1198,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a | |||
}; | |||
} | |||
|
|||
if ([self.camera isEqualToMapCamera:camera]) { | |||
if ([self.camera isEqualToMapCamera:camera] && NSEdgeInsetsEqual(edgePadding, NSEdgeInsetsZero)) { |
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.
edgePadding specified here is self.contentInsets when specified in L.1181.
The documentation doesn't state that this is additional padding, like in #12818 (comment), additional to self.contentInsets.
I believe that we need to check NSEdgeInsetsEqual(edgePadding, self.contentInsets)) here instead.
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.
Oof, thanks, somehow I missed that the macOS implementation is also affected by #12818.
As in #14827, are there tests that can be written to ensure that this functionality does not regress again? |
As in #14664 on iOS, the macOS implementation of MGLMapView should only force a camera change when the content insets are modified by edge padding. Fortunately, the macOS implementation always adds edge padding to the content insets instead of replacing them, so we can check the insets in a consistent way.
Also copyedited changelogs.
/cc @astojilj @fabian-guerra