Skip to content
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

fix: MapConfiguration.interaction_configuration is not honoured #3976

Merged
merged 9 commits into from
Nov 8, 2024

Conversation

ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Sep 12, 2024

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_configuration is correctly applied by adding the interactionOptions parameter to MapOptions.

Enhancements:

  • Add support for handling pointer hover events on the map, triggering a pointer_hover event with relevant details.

Copy link
Contributor

sourcery-ai bot commented Sep 12, 2024

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
  • Changed parameter name from 'json' to 'j' in latLngFromJson, latLngBoundsFromJson, and strokePatternFromJson functions
  • Updated function bodies to use 'j' instead of 'json'
packages/flet_map/lib/src/utils/map.dart
Enhanced parseInteractionOptions and interactionOptionsFromJSON functions
  • Made parseInteractionOptions return nullable InteractionOptions
  • Added optional default value parameter to interactionOptionsFromJSON
  • Implemented null check in interactionOptionsFromJSON
packages/flet_map/lib/src/utils/map.dart
Updated MapOptions configuration in MapControl widget
  • Added interactionOptions to MapOptions using parseInteractionOptions
  • Implemented onPointerHover event handler
  • Added import for flutter/gestures.dart
packages/flet_map/lib/src/map.dart

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on 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.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ndonkoHenri - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@FeodorFitsner
Copy link
Contributor

Can you look at conflicts please?

@FeodorFitsner FeodorFitsner merged commit 95e679f into main Nov 8, 2024
1 of 2 checks passed
@FeodorFitsner FeodorFitsner deleted the fix-map-interactive-flag branch November 8, 2024 19:18
@Michel7GitHub
Copy link

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

@ndonkoHenri
Copy link
Contributor Author

ndonkoHenri commented Nov 29, 2024

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.

@Michel7GitHub
Copy link

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)

@ndonkoHenri
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing the Map's Interactivity has no effect
3 participants