cemrehancavdar / hyperleaflet

https://docs.hyperleaflet.dev/
MIT License
67 stars 3 forks source link

Geometry add-remove mechanism changes #20

Closed cemrehancavdar closed 1 year ago

cemrehancavdar commented 1 year ago

This pull request enhances the adding and removing mechanism in Hyperleaflet for better performance and user experience.

The previous mechanism encountered issues with bulk HTML changes and redundant updates. Additionally, continuously adding/removing the same points on the leaflet map caused usability problems.

To tackle these issues, I have made the following enhancements:

Implemented optimized calculation of "truly" changed geometries using element IDs.
Utilized a Mutation Observer to track changes and handle additions and removals more efficiently.
The observer now checks if a removed node is also present in the added nodes and only sends the nodes that are removed but not added.
Additionally, the observer detects if added nodes are already present in the leaflet map to avoid unnecessary duplicates.
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication