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

feat: add hit detection to Polylines #1728

Merged
merged 24 commits into from
Dec 15, 2023
Merged

Conversation

ignatz
Copy link
Contributor

@ignatz ignatz commented Nov 10, 2023

No description provided.

@JaffaKetchup JaffaKetchup marked this pull request as draft November 10, 2023 22:26
@JaffaKetchup JaffaKetchup changed the title Add an onTap callback to polylines. [POLYLINE] feat: make Polylines tappable Nov 10, 2023
@JaffaKetchup JaffaKetchup changed the title [POLYLINE] feat: make Polylines tappable [PLINE-DEP] feat: make Polylines tappable Nov 10, 2023
@JaffaKetchup JaffaKetchup modified the milestone: Polyline (Non-Perf) Improvements Nov 10, 2023
@JaffaKetchup JaffaKetchup changed the title [PLINE-DEP] feat: make Polylines tappable feat: make Polylines tappable Nov 24, 2023
@JaffaKetchup JaffaKetchup marked this pull request as ready for review November 24, 2023 15:11
@JaffaKetchup
Copy link
Member

@ignatz With all of that decided, it'd be great if you could fix the conflicts here, and just add Hugo's name to the top of the new code (in a comment or something) :)

@JaffaKetchup
Copy link
Member

Also just need to confirm how this PR will interact with #1704, and which should be merged first.

@ignatz
Copy link
Contributor Author

ignatz commented Nov 24, 2023

and just add Hugo's name to the top of the new code (in a comment or something) :)

Help me out. What would you like me to write/credit? I'll put there whatever you'd like me to put.

It's not like FM generally credits authors (which I like) nor is this code based on Hugo's code. I feel a bit silly to mention that there used to be an unrelated plugin that did something similar.

@JaffaKetchup
Copy link
Member

Yeah, we don't normally credit code unless we're absorbing it. In this case, I feel like we should thank Hugo, just something like "Thanks to Hugo H for maintaining tappability until v7, now maintained here for flexibility".

@ignatz
Copy link
Contributor Author

ignatz commented Nov 24, 2023

Sounds reaonsable if there was some sort oft absorbing happening. "Thanks to Hugo for maintaining tappability until v7, now maintained here for flexibility" feels misleading. It seems to imply a lineage where there's none. I also don't quite understand the flexibility argument. If at all, it might be worth pointing out to users that these are entirely separate implementations that behave semantically differently.

@josxha
Copy link
Contributor

josxha commented Nov 24, 2023

I would agree that adding it on top of the implementation could be misleading. It makes sense to me if we want to hint that code got integrated to show the copyright but in this case it's different. 🤔
Maybe the migration docs, release notes and/or changelog fits that message better?

@JaffaKetchup
Copy link
Member

Ok, sure, we'll leave it out of here then, and add it to the docs site.

@ignatz ignatz force-pushed the polyline_tap branch 2 times, most recently from c0b156d to 1433b80 Compare November 24, 2023 22:38
@josxha josxha linked an issue Nov 26, 2023 that may be closed by this pull request
Copy link
Contributor

@josxha josxha left a comment

Choose a reason for hiding this comment

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

Haven't experienced any bugs while testing. Thanks @ignatz for adding a nice showcase to the example app too.
Could you check my comments?

lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
@JaffaKetchup
Copy link
Member

Although this is technically non-breaking, it will not be included in v6.1.0, because of its impact on the plugin.

@josxha josxha added this to the v7.0 milestone Dec 2, 2023
@JaffaKetchup
Copy link
Member

Hey @ignatz, would appreciate your thoughts if you have any!

@ignatz
Copy link
Contributor Author

ignatz commented Dec 12, 2023

Sorry, on what specifically? I did express thoughts before. Would you like me to review the code?

@JaffaKetchup
Copy link
Member

You're right, I just hoped that I've found a solution that isn't too messy. Just wanted to check with you that you couldn't see any glaring issues with this approach that I've missed.

lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
example/lib/pages/polyline.dart Outdated Show resolved Hide resolved
example/lib/pages/polyline.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
…f just `tapKey`

Cleaned up
Fixed bugs surrounding `onTap` variants
Fixed bugs and removed unnecessary code surrounding the detection algorithm's duplication of results
Added equality methods to `Polyline`
Copy link
Contributor Author

@ignatz ignatz left a comment

Choose a reason for hiding this comment

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

I'm glad we argued. I think I like this better than my original proposal. Gives you all the flexibility w/o much complexity. Definitely let's me minimize my fork even more. Thanks

lib/src/layer/polyline_layer.dart Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
@JaffaKetchup
Copy link
Member

JaffaKetchup commented Dec 13, 2023

Ok, everything is ready for final review now :D

I've also written the website documentation for interactivity: https://docs.fleaflet.dev/v/v7-beta/layers/polyline-layer#interactivity. Let me know if that seems suitable and comprehensive enough.
(When tappable Polygons arrive, we can move this documentation into its own page, and make it less specific to Polylines, assuming we follow the same API model.)

Copy link
Contributor Author

@ignatz ignatz left a comment

Choose a reason for hiding this comment

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

LGTM

lib/src/layer/polyline_layer.dart Outdated Show resolved Hide resolved
example/lib/pages/polyline.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@josxha josxha left a comment

Choose a reason for hiding this comment

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

I only found some small suggestions. Up to you how and if you solve them.
Great work @JaffaKetchup and @ignatz!
Tested on windows and web, works like a charm.

lib/src/layer/polyline_layer.dart Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Show resolved Hide resolved
lib/src/layer/polyline_layer.dart Show resolved Hide resolved
@JaffaKetchup JaffaKetchup changed the title feat: make Polylines tappable feat: add hit detection to Polylines Dec 15, 2023
@JaffaKetchup JaffaKetchup merged commit b94de88 into fleaflet:master Dec 15, 2023
6 checks passed
@JaffaKetchup
Copy link
Member

Huge thanks @ignatz! Now on to polygons when you're ready and have had a break from me :D

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

Successfully merging this pull request may close these issues.

None yet

4 participants