Spatial constraint consistently applied to active layers

Fixes issue #774.
Spatial constraint remains consistent after active layer is changed