Skip to content

Commit

Permalink
feat(layer-order): verify baselayer before move layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Aug 30, 2019
1 parent a2ee2d1 commit 531d87d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/geo/src/lib/map/shared/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ export class IgoMap {
}

getLayerByAlias(alias: string): Layer {
return this.layers.find((layer: Layer) => layer.alias && layer.alias === alias);
return this.layers.find(
(layer: Layer) => layer.alias && layer.alias === alias
);
}

/**
Expand Down Expand Up @@ -267,7 +269,7 @@ export class IgoMap {
const zIndexTo = layerTo.zIndex;
const zIndexFrom = layer.zIndex;

if (zIndexTo < 10) {
if (layerTo.baseLayer) {
return;
}

Expand Down Expand Up @@ -333,7 +335,9 @@ export class IgoMap {
*/
private sortLayersByZIndex(layers: Layer[]) {
// Sort by descending zIndex
return layers.sort((layer1: Layer, layer2: Layer) => layer2.zIndex - layer1.zIndex);
return layers.sort(
(layer1: Layer, layer2: Layer) => layer2.zIndex - layer1.zIndex
);
}

/**
Expand Down

0 comments on commit 531d87d

Please sign in to comment.