fix: `MapConfiguration.interaction_configuration` is not honoured
Description
Fixes #3973
Summary by Sourcery
Fix the issue where MapConfiguration.interaction_configuration was not being honored by adding the interactionOptions to MapOptions. Enhance the map functionality by introducing support for pointer hover events, allowing the map to trigger a pointer_hover event with latitude, longitude, and pointer details.
Bug Fixes:
- Ensure
MapConfiguration.interaction_configurationis correctly applied by adding theinteractionOptionsparameter toMapOptions.
Enhancements:
- Add support for handling pointer hover events on the map, triggering a
pointer_hoverevent with relevant details.
Reviewer's Guide by Sourcery
This pull request addresses an issue where the MapConfiguration.interaction_configuration was not being honored. The changes primarily involve refactoring and enhancing the map-related utility functions and the MapOptions configuration in the Flet map package.
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Refactored map utility functions to use 'j' instead of 'json' as parameter name |
|
packages/flet_map/lib/src/utils/map.dart |
| Enhanced parseInteractionOptions and interactionOptionsFromJSON functions |
|
packages/flet_map/lib/src/utils/map.dart |
| Updated MapOptions configuration in MapControl widget |
|
packages/flet_map/lib/src/map.dart |
Tips
- Trigger a new Sourcery review by commenting
@sourcery-ai reviewon the pull request. - Continue your discussion with Sourcery by replying directly to review comments.
- You can change your review settings at any time by accessing your dashboard:
- Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
- Change the review language;
- You can always contact us if you have any questions or feedback.
Can you look at conflicts please?
Hi,
I just installed Flet v0.25.0 Release but the problem is still present : MapConfiguration.interaction_configuration is not honoured.
I tried these flags flags=map.MapInteractiveFlag.ALL & ~map.MapInteractiveFlag.ROTATE
I tested on Windows 11.
I also tried to test on IOS (iPad & iPhone), but Map doesn't display !!! I have to regress to Flet v0.24.1
It works on my mac:
import random
import flet as ft
import flet.map as map
def main(page: ft.Page):
page.add(
map.Map(
expand=True,
initial_center=map.MapLatitudeLongitude(15, 10),
initial_zoom=4.2,
interaction_configuration=map.MapInteractionConfiguration(flags=map.MapInteractiveFlag.NONE),
layers=[
map.TileLayer(
url_template="https://tile.openstreetmap.org/{z}/{x}/{y}.png",
on_image_error=lambda e: print("TileLayer Error"),
),
],
),
)
ft.app(main)
Give the above a try.
Hi ndonkoHenri,
I tried your code on Windows and all flags get OFF (this is OK) BUT the one I want OFF still ON ... Rotate Flag !
Did you try to Rotate on Mac?
I tried your code on iPad (v0.24.1 app) and Windows 11 as server with v0.25.0... Map doesn't display.
Should I update IOS App version ? I don't find new version on AppStore.
I don't know if it's important, but I receive this message (show on my Windows 11 server) when I tried on IOS (iPad) :
C:\Python312\Lib\site-packages\websockets\legacy\server.py:1177: DeprecationWarning: remove second argument of ws_handler warnings.warn("remove second argument of ws_handler", DeprecationWarning)
Yes it works too:
interaction_configuration=map.MapInteractionConfiguration(flags=map.MapInteractiveFlag.ALL & ~map.MapInteractiveFlag.ROTATE)
Will give it a try on my Windows when possible.
Concerning the Flet app, we are working on updating it to support changes made in 0.25.0