-
Notifications
You must be signed in to change notification settings - Fork 122
Mapview.content inset are not working as expected on 5.5.0 #59
Comments
I provide here an example screen: Happening: I would expect both my shape and its bounding box to be inside the contentInset of the map. Expected: What you can see here:
What am I doing:
|
Sorry for the triple post, but I would like to provide as much info as I can to be sure to get to the point: Everything works fine if the EdgeInset are the same on top-bottom or left-right. As soon as there is a difference between top-bottom or left-right.... then the center of the map is not where i would expect it to be. example: let's take the frame of the Map
Let's apply a content Inset LEFT of width/2 = 187 The result should be that the center of the map is located on x at 375 + 187 instead the bounding box starts at 375+ 187 + 187/2 and the right side of the bounding box is at This happens also if I use a camera animation by using Does this mean that the inset moves the viewPort logically but does not shrink the viewport ? EDIT: I manage to make it work the way I expect: Then I get the map correctly centered between 187 and the right side of the screen This shows me that the insets are used to move the map Frame instead of shrinking the viewport and are applied in order one after the other. Hence this clearly look like a bug. @julianrex I am creating issues here now, |
Just verified that the content inset are working correctly when creating a camera around a point. The reason seems to be that the camera to fit the bounding box is calculated correctly respecting the contentInset but then the camera center is calculated wrongly instead. |
I also have the same issue, |
|
Seems to me that |
So the issue is located in mbgl-core, which is on another repo now... What is the process here for a pull request ? |
@RomainQuidet I would say open a PR to the core repo and link this issue and say it's fixing it. I guess tough the new change should not break the SDK tests here. However If it is a core issue I guess similar problems should popup in the android and web sdks. I wonder if the iOS layer on top of is also not reading the data wrong comign from the core |
PR sent, we'll see what's going on ;) My tests show a correct behavior of our app with this patch. |
Repurpose LatLngBoundsToCameraWithBearingAndPitch to test scaling and camera setup, both with and without padding. This adds testing of path not covered in mapbox/mapbox-gl-native-ios#59.
Repurpose LatLngBoundsToCameraWithBearingAndPitch to test scaling and camera setup, both with and without padding. This adds testing of path not covered in mapbox/mapbox-gl-native-ios#59.
@RomainQuidet @astojilj I see the PR was merged! When we can expect this in a SDK Release? Thanks |
yes, really cool they accepted the correction. It's now on master branch of mapbox-gl-native submodule, it needs to be taken by iOS devs on this project. |
This is awesome @RomainQuidet @racer1988 - thanks so much for submitting that PR, and thanks @astojilj for landing this in gl-native!
This will be in |
Thanks for your help with this investigation @RomainQuidet @racer1988! The fix will also be available in pre-releases in January for you to test and confirm the issue is resolved. Expect an |
Repurpose LatLngBoundsToCameraWithBearingAndPitch to test scaling and camera setup, both with and without padding. This adds testing of path not covered in mapbox/mapbox-gl-native-ios#59.
We're now facing a regression that might be caused by this fix when doing flyTo with edgePadding on ios: See #198 I think that the cause is that when converting CameraOptions to MGLMapCamera edgePadding is ignored: mapbox-gl-native-ios/platform/ios/src/MGLMapView.mm Lines 4011 to 4025 in a139216
Before the fix in this pr edgePadding was not used in the C++ |
@mfazekas thanks for the report. Could you open a separate ticket to track this potential regression? |
@RomainQuidet do you have a proposal how to reconcile this with #198? |
Hi @astojilj I'm sorry I don't work on my customer's project involving mapbox anymore. Anyway if I have some free time I'll check both issues and the code. |
No worries, we'll fix it. Thanks again. |
Hello, after the changes to the contentInset in 5.5.0 I don't understand how the content inset is used.
Example:
The mapview has a frame width of 300
I set contentInset.left to 100
I set contentInset.right to 50
I would expect that if I zoom to a square MGLRegionBound I would see it inset by 100 on the left and 50 on the right.
However this is not happening.
The mapView FRAME is shifted by those values, so the region bound is not respected.
I see the box 100 px from the left but only some pixel from the right.
Why is that?
It looks to me that the left inset is applied to shift the entire mapview frame and then the region bound is drawn.
Another example is this:
set left to 300px
right to 0px
I would expect to see the region attached to the border on the right, starting 300 px from the left.
Instead, the region is totally out of the screen.
Could you explain me if I understood the inset wrong or this is a bug due to mapbox/mapbox-gl-native#15584 ? thanks
The text was updated successfully, but these errors were encountered: