wegue-oss / wegue

Template and components for webmapping applications with OpenLayers and Vue.js
BSD 2-Clause "Simplified" License
93 stars 41 forks source link

Fix layer property reactivity #368

Open fschmenger opened 3 months ago

fschmenger commented 3 months ago

This is my take on how we could possibly fix the layer-property-reactivity issue mentioned in #365. To keep changes minimal I decided to wrap up OL layers and OL layer collections by proxy objects. The proxy objects behave mostly transparent and forward invocations to the underlying layer / collection objects, so they can be basically used as a drop-in. Apparently, use them only for Vue components when reactivity is required.

Using LayerProxy around an OL layer:

Similarly, using LayerProxyCollection around an OL Collection:

So far, this only the proof of concept. Here is the list of (open) tasks: 1) Implement layer proxy object (done) 2) Implement layer collection proxy (done) 3) Use layer proxy and proxy collection in various vue components. A quick search yielded:

fschmenger commented 3 months ago

Hi guys, here is where to take a closer look:

Unfortunately I will have to focus on other projects again in the upcoming months, so take your time for review. If we're happy with the overall solution, feel free to work on it. It should`t be too much from here on.

Cheers Felix