-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1184 from dbauszus-glx/layer-changeend
Create layer changend module.
- Loading branch information
Showing
5 changed files
with
49 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
### mapp.layer.changeEnd(layer) | ||
@module /layer/featureFilter | ||
*/ | ||
|
||
export default function(layer) { | ||
|
||
// The layer may be zoom level restricted. | ||
layer.tables && layer.mapview.Map.getTargetElement().addEventListener('changeEnd', changeEnd) | ||
|
||
function changeEnd() { | ||
|
||
// Layer is out of zoom range. | ||
if (!layer.tableCurrent()) { | ||
|
||
if (layer.display) { | ||
|
||
// Layer should be shown if possible. | ||
layer.zoomDisplay = true | ||
layer.hide() | ||
} | ||
|
||
return; | ||
} | ||
|
||
if (layer.zoomDisplay) { | ||
|
||
// Prevents layer.show() being fired on zoom change within range. | ||
delete layer.zoomDisplay | ||
|
||
// Show layer if within zoomDisplay range. | ||
layer.show() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters