AlexLavoie42 / Nuxt-Mapbox

Elegant Mapbox integration with Nuxt
81 stars 11 forks source link

Feature Request: reactive layers #83

Closed jasonhibbs closed 7 months ago

jasonhibbs commented 7 months ago

I love where this module is going, so here’s my request for the soal-mapbox feature I use the most.

For paint, layout, and filter, soal-mapbox used watchers to update the map. Here’s an example:

    if (this.layer.paint) {
      this.$watch(
        "layer.paint",
        function(next) {
          if (this.initial) return;
          if (next) {
            for (let prop of Object.keys(next)) {
              this.map.setPaintProperty(this.layerId, prop, next[prop]);
            }
          }
        },
        { deep: true }
      );
    }
AlexLavoie42 commented 7 months ago

Totally missed watching the layer properties. I am doing this for most other components.

Would be pretty easy to just copy what is used in MapboxMap.vue over to the layer component for properties that can be modified.

PR would be greatly appreciated if possible!