mapcentia / vidi

Vidi – a modern take on browser GIS. It is the front-end client for GC2.
https://www.osgeo.org/projects/gc2-vidi/
GNU Affero General Public License v3.0
44 stars 24 forks source link

Layers "Stick" in print when initially loaded #244

Closed giovanniborella closed 2 years ago

giovanniborella commented 2 years ago

When starting vidi with a layer in the url, like #ForvaltningskortDF/11/8.8162/56.0933/fjelstervangvand.ledninger_hovedledning the layer gets correctly parsed. However the layer is already added in the layerTree module, hence the resulting activeLayers ends up like this ['fjelstervangvand.ledninger_hovedledning','fjelstervangvand.ledninger_hovedledning'].

When toggling said layer off, only 1 entry is removed. Key persists in activeLayers - resulting in the layer beeing visible when printing.

A quick fix would be to allow layerTree to control the contents of activeLayers, and just returning result in the following line

https://github.com/mapcentia/vidi/blob/74cc90fba034c5c785da4ee4dd646bfd79b55f01/browser/modules/layerTree/index.js#L317

to reproduce:

  1. load vidi with layer in url
  2. print to view layer
  3. toggle layer off
  4. print to view the same layer again