ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
683 stars 229 forks source link

How to turn off map events #45

Open dmcd opened 6 years ago

dmcd commented 6 years ago

Hi @ghettovoice, Thanks for the great library.

Is there a way to make the subscription to open layers map events optional? I'm asking because there are so many events fired from the map that the Vue Devtools chrome extension crashes when set to record events. I realise this is really an issue with Vue Devtools but I'm just wondering if you have any thoughts on this? So many events also makes it difficult to debug other events in an app.

Cheers

ghettovoice commented 6 years ago

Hi, @dmcd, thank you for your response! You are right, mainly it is an issue with DevTool because it dig into vue components subscribes to each event vuejs/vue-devtools#449. Currently the only workaround is events filtering or disabling, I know it's not a best solution, but throttling some map events from vuelayers can lead to laggy animation and other artifacts. I can try to add Object.freeze for each event before emit, I'll test this soon and write here. Maybe someone knows better solution, I'm open for discuss.

ghettovoice commented 6 years ago

Object.freeze doesn't work. Event object in Vue isn't reactive, so it doesn't facilitates DevTool life

dmcd commented 6 years ago

Thanks for looking into this. Hopefully they'll resolve vuejs/vue-devtools#449.

FYI, the issue with devtools is exasperated in the vuelayers-demo because of the animating flag marker, to the point where I couldn't disable the events in devtools fast enough to avoid it crashing. Instead I had to first comment out the render in the demo App.vue, line 360.

    onMapPostCompose ({ vectorContext, frameState }) {
      ...

      // this.$refs.map.render()
    },
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.