Skip to content

Commit

Permalink
fix(ngw): ngw webmap resource ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
rendrom committed Jan 27, 2020
1 parent 00ed0a5 commit fb0e502
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 5 additions & 3 deletions packages/ngw-kit/src/WebMapLayerItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ export class WebMapLayerItem extends Item<ItemOptions> {
...item,
headers: this.options.headers
};
if (this.options.order && this.options.drawOrderEnabled) {
const subOrder = this._rootDescendantsCount - item.draw_order_position;
options.order = this.options.order + subOrder * 0.1;
if (this.options.order) {
const subOrder = this.options.drawOrderEnabled
? this._rootDescendantsCount - item.draw_order_position
: this.id;
options.order = Number((this.options.order | 0) + '.' + subOrder);
}
newLayer = await this.webMap.addLayer(adapter, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class NgwLayersList extends Vue {

@Watch('ngwMap')
updateNgwMap() {
console.log(1234);
this.destroy();
this.create();
}
Expand Down Expand Up @@ -198,9 +197,7 @@ export class NgwLayersList extends Vue {
if (
item.children &&
this.hideWebmapRoot &&
webMapLayer.layer &&
webMapLayer.layer.item &&
webMapLayer.layer.item.item_type === 'root'
webMapLayer.layer?.item.item_type === 'root'
) {
item.children.reverse().forEach(x => this.items.push(x));
webMapLayer.layer && webMapLayer.layer.properties.set('visibility', true);
Expand Down
2 changes: 1 addition & 1 deletion packages/webmap/src/WebMapLayers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class WebMapLayers<
E extends WebMapEvents = WebMapEvents
> extends BaseWebMap<M, L, C, E> {
private _layersIds = 1;
private _layersOrders = 0;
private _layersOrders = 1;
private readonly _baseLayers: string[] = [];
private readonly _layers: { [id: string]: LayerAdapter } = {};
private readonly _selectedLayers: string[] = [];
Expand Down

0 comments on commit fb0e502

Please sign in to comment.