Umbrella
Umbrella

Reputation: 1145

How do I reset an extent of a layer to default?

My map has multiple regions. If a certain region is selected I restrict all avalaible layers to an extent of a selected region by setting "extent" property like so: allLayers.forEach(l => l.setExtent(extent)). Whenever I unselect a region I want to see the whole map again. How do I reset the extent of the layers whose extent I changed before?

Upvotes: 1

Views: 610

Answers (1)

Umbrella
Umbrella

Reputation: 1145

Figured it out. allLayers.forEach(l => l.setExtent(undefined)). Had to pass undefined so typescript doesn't yell at me, empty braces are supposed to work too.

Upvotes: 1

Related Questions