-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
[Map] markers, polygons and polylines removal #2547
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sblondeau and thanks for your suggestion, I was waiting for someone to open it! :D
It's a very, very good start, but there are still things to refactor and simplify:
- I believe
Map::remove*()
methods must acceptMarker|string $markerOrId
as parameter, so we can remove methodsMap::get*()
Map::get*()
methods do not really make sense to me, since there is no modifiers onMarker
/Polygon
/Polyline
. Once you construct them, you can't alter them, so not point forMap::get*()
.- Some architecture things can be improved, see review comments
- Types definitions in
assets/
must be updated to, since you added a new propertyidentifier
(which can be shortened and changed toid
) - Also, please apply Fapbot's suggestions
Thanks, and do not hesitate if necessary! :)
Do you need some help here @sblondeau ? |
No time at all last week, but I will try to work on it in the next day :-) Thanks for your comments |
Thanks for your comments @Kocal. One question, that's true that a Marker is readonly... but can we imagine that we getMarker() to modify its position, title or infoWindow ? so we should remove and recreate it ? |
For the moment, yes, we can implement If really necessary, let's open a separate PR to make them non-readonly and implement |
aac7b0f
to
ad52699
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for applying suggestions.
Can you please revert changes unrelated to Map and the removal feature please? 🙏🏻
ad52699
to
0f64532
Compare
277d6a6
to
3acd83e
Compare
51ff6a5
to
a27bd08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like where we are now!
I'll test your PR locally before approving it and merging it.
I've tested your PR and it works well: Enregistrement.de.l.ecran.2025-02-15.a.17.14.57.movI did some minor adjustments to mark those classes as internal. |
…stances from a Map
7f48247
to
e19fff9
Compare
Thanks @sblondeau. |
…u, Kocal) This PR was merged into the 2.x branch. Discussion ---------- [Map] markers, polygons and polylines removal | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Add new methods to remove markers, polygons or polylines (map elements) Map elements will be store in SplObjectStorage instead of arrays. When create a map element, you can now add an optional identfier (string). New methods `getMarker(string identifier)`, `getPolygon(string identifier)` and `getPolyline(string $identifier)` car retreive a map element from its identfiier. example $departureMarker = new Marker ( position: new Point(45.7640, 4.8357), title: 'Lyon', identifier: 'departure' ) $map->addMarker($departureMarker); // remove marker with $map->removeMarker($departureMarker) // or $map->removeMarker($map->getMarker('departure')); Commits ------- 7f48247 [Map] Minor adjustements a27bd08 allow marker, polygone and polyline removal
Add new methods to remove markers, polygons or polylines (map elements)
Map elements will be store in SplObjectStorage instead of arrays.
When create a map element, you can now add an optional identfier (string).
New methods
getMarker(string identifier)
,getPolygon(string identifier)
andgetPolyline(string $identifier)
car retreive a map element from its identfiier.example
$departureMarker = new Marker (
position: new Point(45.7640, 4.8357),
title: 'Lyon',
identifier: 'departure'
)