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] improve performance significantly by selectively updating the Polygon options #524

Open
nimlevy opened this issue Sep 10, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@nimlevy
Copy link

nimlevy commented Sep 10, 2024

Target Use Case

We are using the library to give our clients the ability to select zip code areas on the Google Map. Imagine a map marked with zip code boundaries, the user can hover to see details and then click to select the zip code (changing opacity and adding to a list)

Proposal

The issue (somewhere between a bug and a feature) is that the dependencies of the Polygon example (and probably the other geometry components as well) where the polygon.setOptions is called, are setting the options every time the mouse hovers over the polygon's area.
Updating the dependencies to the specific properties that would affect the rendering of the polygon (e.g. the strokeOpacity, fillOpacity, etc.) drastically improves performance.

I am not sure what is the best way to go about it, but the assumption stated in the following comment is, unfortunately, incorrect.

// update PolygonOptions (note the dependencies aren't properly checked
// here, we just assume that setOptions is smart enough to not waste a
// lot of time updating values that didn't change)

In other words - the setOptions is not smart enough.

Note: I have seen a drastic decrease in performance (color changes, info window's movement, etc. were lagging badly) when using the original format of paths (array of lat & lng) that React's dependency check could not properly compare

@usefulthink usefulthink added enhancement New feature or request good first issue Good for newcomers labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants