-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zoom gesture works only on half screen on orientation change #195
Comments
I was able to reproduce this. If I tilt my phone from vertical to horizontal (counter-clockwise), for example, about the right half of the screen doesn't react to drag or zoom gestures. Double tapping works and drag gestures started in the "unresponsive area" that continue to the "responsive area" work for the part in the "reponsive area". |
I'm also experiencing this. Originally noticed the same issue in portrait mode so I started to cut away parent comonents to isolate the issue but I was not able to reproduce it reliably. It makes me think that it's something to do with redrawing the map rather than tilting itself. |
Thank you all for chiming in, I'm having trouble reproducing this. Could someone 👀 #201 and check how that setup differs from yours? Do you have a specific setup for handling orientation changes? Atm I'm guessing that the resize isn't correctly handled, having a minimal reproducible test case would be great! |
Still having this issue with the latest version. My map is on fullscreen within a Stack. Tapping works fine, pinching only in the "old" area before the orientation change. I will check the example project to find an easy to reproduce setup. |
The issue is actually pretty easy to reproduce. Simply run the "Full screen map" example and change the orientation. When changed from landscape to portrait, the pinch or drag gesture in the lower area does not work. When changing from initially portrait mode to landscape, the pinch or drag gesture in the right area does not work. Wrapping the MapboxMap into an OrientationBuilder does not fix it either. Although the build function is called, the map is not getting reinitialised (the onMapCreated function is not called). |
As a dirty workaround it is possible to rebuild the widget tree two times. First time returning an empty Container and add a post frame callback, second time the entire tree including map. This reinitializes the map and updates the gesture active area. This adds a lot of lag and 0,5 seconds empty screen so definitely not recommended. This should be fixed within Mapbox. |
Is there any update on this issue? The problem still persists. Reinitialising the map causes other issues, because Flutter Mapbox seems to loose track of some channel methods after the rebuild, so after orientation change I get "MissingPluginException". I really appreciate a clean solution for this issue. |
This is also happening when opening/closing the keyboard... |
Same here... |
Found a hacky way to fix this issue after 1 month struggling with it:
Sum up: Make a square SizedBox with side = max(screenWidth, screenHeight), then set the SizedBox's side back to equals the screen size after first camera move started callback called. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@teddichiiwa Somehow I'm failing at applying your fix to flutter-maplibre-gl. Can you maybe elaborate what the idea behind the fix is and what "when camera move started call back" means? Which callback are you referring to? |
|
@maxammann would you mind creating a pr adding this to this package or creating a separate package with your helper? |
@felix-ht I just got response that it does not yet work in release mode :) I'll try to fix it again later this week. After that a PR would be possible. |
@maxammann Sorry for late response, our team rewrite the PlatformView using Hybrid Composition and this bug will be gone (see: https://docs.flutter.dev/development/platform-integration/platform-views). |
Alright so this whacky and hacky workaround works now for us: It required quite some fine-tuning to cover edge cases. Make sure that when the initial render of the map happens that it is already visible. This means it should not be covered by a route which hides the map. |
I'm not sure whether this should be included in the respository. I think the root cause of this should be fixed. |
When phone orientation changes (From portrait to landscape and vice versa) zoom gestures work only on half screen (where the original orientation pixels are equals to new orientation).
This was tested into a mapBoxMap builded with a lot of widgets and on a page with only a Scaffold and a instance of mapboxmap (Android).
The text was updated successfully, but these errors were encountered: