Compare commits
No commits in common. "2825ce4ccce7d592aa380f0483a574fdf0c97272" and "0d40141b2d66fb98c74b6861cb3f8fa589c5a824" have entirely different histories.
2825ce4ccc
...
0d40141b2d
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "farmmaps-lib-app",
|
||||
"version": "2.1.3",
|
||||
"version": "2.1.2",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
|
@ -364,12 +364,16 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
}
|
||||
}
|
||||
|
||||
installTopLayerPrerenderEventhandler(olLayer : Layer<Source>) {
|
||||
if(!this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 && olLayer) {
|
||||
installTopLayerPrerenderEventhandler() {
|
||||
if(!this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 ) {
|
||||
if(this.instance.getVisible()) {
|
||||
olLayer.on('prerender',this.topLayerPrerenderEventhandler);
|
||||
olLayer.on('postrender',this.topLayerPostrenderEventhandler);
|
||||
this.topLayerPrerenderEventhandlerInstalled = true;
|
||||
var olLayers = this.instance.getLayers().getArray().filter(l=> l.getVisible());
|
||||
if(olLayers.length >0) {
|
||||
var topLayer = olLayers[0] as any;
|
||||
topLayer.on('prerender',this.topLayerPrerenderEventhandler);
|
||||
topLayer.on('postrender',this.topLayerPostrenderEventhandler);
|
||||
this.topLayerPrerenderEventhandlerInstalled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -378,11 +382,13 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 )
|
||||
{
|
||||
if(this.instance.getVisible()) {
|
||||
var olLayers = this.instance.getLayers().getArray().forEach((l:any) => {
|
||||
l.un('prerender',this.topLayerPrerenderEventhandler);
|
||||
l.un('postrender',this.topLayerPostrenderEventhandler);
|
||||
});
|
||||
this.topLayerPrerenderEventhandlerInstalled = false;
|
||||
var olLayers = this.instance.getLayers().getArray().filter(l=> l.getVisible());
|
||||
if(olLayers.length >0) {
|
||||
var topLayer = olLayers[0] as any;
|
||||
topLayer.un('prerender',this.topLayerPrerenderEventhandler);
|
||||
topLayer.un('postrender',this.topLayerPostrenderEventhandler);
|
||||
this.topLayerPrerenderEventhandlerInstalled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -412,19 +418,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return layer;
|
||||
}
|
||||
|
||||
updateLayers(itemLayers: IItemLayer[] | IItemLayer) {
|
||||
updateLayers(itemLayers: IItemLayer[]) {
|
||||
this.unInstallTopLayerPrerenderEventhandler();
|
||||
let dataLayer = false;
|
||||
var ils:IItemLayer[] = [];
|
||||
if(Array.isArray(itemLayers)) {
|
||||
ils = itemLayers;
|
||||
} else {
|
||||
dataLayer=true;
|
||||
ils=[itemLayers];
|
||||
}
|
||||
let newLayers: Layer<Source>[] = [];
|
||||
if (ils) {
|
||||
ils.forEach((itemLayer, index) => {
|
||||
if (itemLayers) {
|
||||
itemLayers.forEach((itemLayer, index) => {
|
||||
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
||||
let il = itemLayer as ITemporalItemLayer;
|
||||
let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);
|
||||
@ -433,11 +431,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
if(selectedLayer) newLayers.push(selectedLayer);
|
||||
let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
|
||||
if(nextLayer) newLayers.push(nextLayer);
|
||||
this.installTopLayerPrerenderEventhandler(selectedLayer);
|
||||
} else {
|
||||
let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
|
||||
if(layer) newLayers.push(layer);
|
||||
this.installTopLayerPrerenderEventhandler(layer);
|
||||
if(layer) newLayers.push(layer);
|
||||
}
|
||||
});
|
||||
// Remove the layers that have disapeared from childrenLayers
|
||||
@ -446,11 +442,12 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
olLayers.removeAt(newLayers.length);
|
||||
}
|
||||
this.selectionLayer=null;
|
||||
if(this.mapEventHandlerInstalled && ils.length==1 && this.getItemlayer(itemLayers[0]).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
||||
if(this.mapEventHandlerInstalled && itemLayers.length==1 && this.getItemlayer(itemLayers[0]).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
||||
this.selectionLayer = this.createSelectionLayer(this.getItemlayer(itemLayers[0]));
|
||||
if(this.selectionLayer) olLayers.push(this.selectionLayer)
|
||||
}
|
||||
}
|
||||
this.installTopLayerPrerenderEventhandler();
|
||||
}
|
||||
|
||||
topLayerPrerenderEventhandler = (event) => {
|
||||
|
Loading…
Reference in New Issue
Block a user