Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MapLibre welcomes participation and contributions from everyone. Please read [`M

## 6.29.0

- iOS: Clear transient edge padding when setting an unchanged camera.
- fix(core): accept alpha in hsl colors ([#4435](https://github.com/maplibre/maplibre-native/pull/4435)).
- fix(core): repaint feature-state-driven symbol paint properties ([#4445](https://github.com/maplibre/maplibre-native/pull/4445)).
- Make string expressions operate on unicode ([#4344](https://github.com/maplibre/maplibre-native/pull/4344)).
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/src/MLNMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4317,7 +4317,7 @@ - (void)setCamera:(MLNMapCamera *)camera
}

if ([self.camera isEqualToMapCamera:camera] &&
UIEdgeInsetsEqualToEdgeInsets(_contentInset, edgePadding)) {
UIEdgeInsetsEqualToEdgeInsets(self.cameraEdgeInsets, edgePadding)) {
if (pendingCompletion) {
[self animateWithDelay:duration animations:pendingCompletion];
}
Expand Down
33 changes: 33 additions & 0 deletions platform/ios/test/MLNMapViewGestureRecognizerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,39 @@ - (void)mapView:(MLNMapView *)mapView didFinishLoadingStyle:(MLNStyle *)style {
[_styleLoadingExpectation fulfill];
}

- (void)testSetCameraClearsTransientEdgePaddingWhenCameraIsUnchanged {
UIEdgeInsets contentInset = UIEdgeInsetsMake(1, 2, 3, 4);
UIEdgeInsets transientPadding = UIEdgeInsetsMake(0, 0, 20, 0);
self.mapView.contentInset = contentInset;
MLNMapCamera *targetCamera = self.mapView.camera;
XCTestExpectation *expectation = [self expectationWithDescription:@"Camera padding cleared"];
__weak __typeof__(self) weakSelf = self;

[self.mapView setCamera:targetCamera
withDuration:0
animationTimingFunction:nil
edgePadding:transientPadding
completionHandler:^{
MLNMapView *mapView = weakSelf.mapView;
auto cameraPadding = mapView.mbglMap.getCameraOptions().padding;
auto expectedPadding = MLNEdgeInsetsFromNSEdgeInsets(contentInset) +
MLNEdgeInsetsFromNSEdgeInsets(transientPadding);
XCTAssertEqual(cameraPadding, expectedPadding);

[mapView setCamera:targetCamera
withDuration:0
animationTimingFunction:nil
edgePadding:UIEdgeInsetsZero
completionHandler:^{
[expectation fulfill];
}];
}];
[self waitForExpectationsWithTimeout:2 handler:nil];

auto cameraPadding = self.mapView.mbglMap.getCameraOptions().padding;
XCTAssertEqual(cameraPadding, MLNEdgeInsetsFromNSEdgeInsets(contentInset));
}

- (void)testHandlePinchGestureContentInset {
UIEdgeInsets contentInset = UIEdgeInsetsMake(1, 1, 1, 1);
self.mapView.contentInset = contentInset;
Expand Down