Some fixes

This commit is contained in:
Willem Dantuma 2020-12-18 20:16:22 +01:00
parent 1a1cd7a81c
commit 80fec7ccaa

View File

@ -129,7 +129,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
source: new VectorTileSource({
maxZoom: rt.maxzoom,
minZoom: rt.minzoom,
format: new MVT(),
format: new MVT({idProperty:'OBJECTID'}),
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${Date.parse(item.updated)}`
}),
style: (feature) => {
@ -196,7 +196,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
});
}
if(l.minzoom) {
layer.setMinZoom(14);
layer.setMinZoom(l.minzoom);
}
if(l.maxzoom) {
layer.setMaxZoom(l.maxzoom);
@ -219,12 +219,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
return new style.Style(
{
fill: new style.Fill({
color: 'red'
}),
stroke: new style.Stroke({
color: 'red',
width: 1.25
width: 2
})
}
);
@ -392,14 +389,14 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
//if(event.type === 'click' && !this.onFeatureSelected.observers.length) return;
//if(event.type === 'pointermode' && !this.onFeatureHover.observers.length) return;
if(this.itemLayer && this.itemLayer.layer) {
this.itemLayer.layer.getFeatures(event.pixel).then((features) => {
this.selectedFeatures = {};
this.itemLayer.layer.getFeatures(event.pixel).then((features) => {
if(!features.length) return;
let fid = features[0].getId();
this.selectedFeatures[fid] = features[0];
console.debug(features[0]);
if(this.selectionLayer) this.selectionLayer.changed();
})
if(this.selectionLayer) this.selectionLayer.changed();
}
}