-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add map padding to the MapboxMap object #3761
Comments
Will be added as: public final void setPadding (int left, int top, int right, int bottom) Other methods mentioned in that section are here:
|
Will this be related to Content Insets in #3627? |
@bleege they seem related, |
Been looking into the setPadding by playing around with Google maps SDK in a sample app, Update: |
After hooking up the setPadding method. I'm not seeing any changes with prior screenshot.. Update: Update: |
Now that I have a better understanding about the missing pieces required to have this on Android:
|
Hi @tobrun, it's good to see this subject come back to front. About your comment, I was thinking may be setPadding should update camera once it has been set ? |
Ha I see your last comment too late :). |
@lgeromegnace, awesome and thanks again for the contribution! |
For the overlain views I'm going to introduce a new class for
The margins from above must be updated if we set a certain padding, but most importantly it must only update margins in a certain direction (based on gravity attribute). update: update: update: |
We will need to provide a way to invalidate the margins/gravity associated with a |
Noticing that I also need to update some code related to gestures
|
To correctly manage the change in #3899 I need to find some code on a stale branch. |
This is the refactored stale code: private void validateGesturesForTrackingModes() {
if(!dismissTrackingOnGesture) {
int myLocationTrackingMode = getMyLocationTrackingMode();
int myBearingTrackingMode = getMyBearingTrackingMode();
// Enable/disable gestures based on tracking mode
if (myLocationTrackingMode == MyLocationTracking.TRACKING_NONE) {
uiSettings.setScrollGesturesEnabled(true);
uiSettings.setRotateGesturesEnabled(true);
} else {
uiSettings.setScrollGesturesEnabled(false);
uiSettings.setRotateGesturesEnabled((myBearingTrackingMode == MyBearingTracking.NONE));
}
}
} Code above will enable/disable certain gestures if we are not automatically dismissing tracking modes. |
I was able to correctly calculate center of gesture in case of tracking mode 💥 |
All usecases of gestures are working except for tilt.. |
Apparently to fix above we first need to expose this through void Map::setPitch(double pitch, const PrecisionPoint& anchor, const Duration& duration) {
transform->setPitch(pitch * M_PI / 180, anchor, duration);
update(Update::Repaint);
} currently we are using: void Map::setPitch(double pitch, const Duration& duration) {
setPitch(pitch, {NAN, NAN}, duration);
} |
After 👊 with JNI I was able to compile and call the native method. |
Going to punt on above and move back to On iOS this is handled here 6a0b7f8#diff-20502b6bc02986a4398d0da84b2d4b94R808 We just need to reset CameraPosition to current position. |
💥 I was able to implement above: We now just need 2 more things to close this:
|
Going to punt on current progress and add a PR for current progress. |
@tobrun Good call on breaking this issue up into smaller tasks. Gets the working code in quicker and brings more clarity to the remaining issues. 👍 |
When padding is added to a map, the map continues to fill the entire container, but text and control positioning, map gestures, and camera movements will behave as if it has been placed in a smaller space. Android's corresponding implementation is described here.
Related (MapboxMap class): #3145
/cc: @tobrun @bleege
The text was updated successfully, but these errors were encountered: