biigle / annotations

:m: BIIGLE module to create, edit and explore image annotations
0 stars 1 forks source link

Prevent Vue from making map reactive #108

Closed mzur closed 5 years ago

mzur commented 5 years ago

The annotations are passed through to some components in the annotation canvas (from here). It seems like they store some reference to their parent (the OpenLayers map) because after passing the annotations through, everything is made reactive by Vue. I wanted to prevent that because OpenLayers should work as fast as possible without being hindered by Vue reactive getters/setters. Find out how the annotations can be passed on without making everything reactive. Also, look for possible other locations where the map might be made reactive by accident.

mzur commented 5 years ago

This idea might be a start. In a quick test the objects seemed to be skipped in being made reactive. But I couldn't see a significant improvement in CPU consumption (although the fan seemed to run less when I modified an annotation).

mzur commented 5 years ago

Apparently the map gets reactive here because the annotation features (which have a reference back to the map) are passed on as props of a component. The reactive map causes an infinite loop here as the computed property is updated whenever the map changes (which is almost always). This has to be fixed before #103 is shipped.

mzur commented 5 years ago

I attempted a fix in 884f7a3. Review this tomorrow.

mzur commented 5 years ago

Looks good. This is ready for production.