Open Kocal opened 5 days ago
Thanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR. Please review the changes and make sure they are expected.
File | Before (Size / Gzip) | After (Size / Gzip) |
---|---|---|
Map | ||
abstract_map_controller.d.ts |
3 kB
/ 741 B
|
3.31 kB +10% π
/ 821 B +11% π
|
abstract_map_controller.js |
1.88 kB
/ 610 B
|
3.23 kB +72% π
/ 843 B +38% π
|
Map (Bridge Google) | ||
map_controller.d.ts |
2.07 kB
/ 729 B
|
2.19 kB +6% π
/ 733 B +1% π
|
map_controller.js |
7.07 kB
/ 1.67 kB
|
8.7 kB +23% π
/ 1.95 kB +17% π
|
Map (Bridge Leaflet) | ||
map_controller.d.ts |
1.31 kB
/ 544 B
|
1.57 kB +20% π
/ 579 B +6% π
|
map_controller.js |
5.52 kB
/ 1.77 kB
|
7.2 kB +30% π
/ 2.06 kB +16% π
|
Note: Usages and examples can be a bit limited for the moment, but for a next PR I would like to add more methods like getZoom()
or removeMarker()
(...)
Hereβs a corrected and polished version of your text:
Hi! π
This PR enhances the UX Map to be compatible with Live Components, allowing you to interact with the
Map
directly from your PHP code. You can perform actions and see your map update in real-time from the front-end!To achieve this, I had to refactor and improve several areas:
toArray
and newfromArray
methods forMap
,Marker
, and all other value objects could rebuild an equivalent object accurately (e.g.,$marker == Marker::fromArray($marker->toArray())
).view
object containingzoom
,center
,markers
, etc. These properties were split into individual values to improve performance.@id
is now automatically computed for eachMarker
andPolygon
definition. This optimization makes rendering significantly more efficient, avoiding the need to remove and re-render all markers or polygons (and avoiding a visual glitch aswell).https://github.com/user-attachments/assets/c151e64c-7321-46d3-a5c6-cfeaf57beb47
https://github.com/user-attachments/assets/ffb12035-a0c3-48b3-afb7-ddf2c24c318a