-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #2385 [Map] Make UX Map compatible with Live Components (and …
…some internal things) (Kocal) This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Map] Make UX Map compatible with Live Components (and some internal things) 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 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: 1. Due to the hydration and de-hydration processes of Live Components, I ensured that the `toArray` and new `fromArray` methods for `Map`, `Marker`, and all other value objects could rebuild an equivalent object accurately (e.g., `$marker == Marker::fromArray($marker->toArray())`). 2. Since Stimulus monitors value changes, it wasn’t efficient to store everything in a single large `view` object containing `zoom`, `center`, `markers`, etc. These properties were split into individual values to improve performance. 3. Before rendering the map, an ``@id`` is now automatically computed for each `Marker` and `Polygon` 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 Commits ------- 74d937a Apply `@smnandre`'s suggestions from code review 7d30e20 [Map] Listen for zoom, center, markers and polygons changes, and update JS tests aae9ddd [Map] Complete and simplify the normalization/denormalization process of Map's value objects, add MapOptionsNormalizer 4744d3d [Map] Add "fromArray" methods to options and other DTO, make "*Array" methods internal 8ab164b [Map] Split "view" attribute into multiple attributes
- Loading branch information
Showing
40 changed files
with
1,127 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.