diff --git a/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts b/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts index d950cca00e..836bdb7c8c 100644 --- a/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts +++ b/packages/geo/src/lib/layer/shared/layers/vectortile-layer.ts @@ -5,14 +5,19 @@ import { MVTDataSource } from '../../../datasource/shared/datasources/mvt-dataso import { Layer } from './layer'; import { VectorTileLayerOptions } from './vectortile-layer.interface'; +import { TileWatcher } from '../../utils'; export class VectorTileLayer extends Layer { public dataSource: MVTDataSource; public options: VectorTileLayerOptions; public ol: olLayerVectorTile; + private watcher: TileWatcher; + constructor(options: VectorTileLayerOptions) { super(options); + this.watcher = new TileWatcher(this); + this.status$ = this.watcher.status$; } protected createOlLayer(): olLayerVectorTile { diff --git a/packages/geo/src/lib/layer/utils/tile-watcher.ts b/packages/geo/src/lib/layer/utils/tile-watcher.ts index 651c18fc8f..008d53a10c 100644 --- a/packages/geo/src/lib/layer/utils/tile-watcher.ts +++ b/packages/geo/src/lib/layer/utils/tile-watcher.ts @@ -2,6 +2,7 @@ import olSourceTile from 'ol/source/Tile'; import { uuid, Watcher, SubjectStatus } from '@igo2/utils'; import { TileLayer } from '../shared/layers/tile-layer'; +import { VectorTileLayer } from '../shared/layers/vectortile-layer'; export class TileWatcher extends Watcher { private id: string; @@ -10,7 +11,7 @@ export class TileWatcher extends Watcher { private source: olSourceTile; - constructor(layer: TileLayer) { + constructor(layer: TileLayer | VectorTileLayer) { super(); this.source = layer.options.source.ol; this.id = uuid();