Skip to content

Commit

Permalink
fix: Wait for drawables before accessing them
Browse files Browse the repository at this point in the history
  • Loading branch information
raitisbe committed Aug 2, 2021
1 parent 9e6e152 commit ccc705c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions projects/hslayers/src/components/draw/draw.service.ts
Expand Up @@ -511,12 +511,11 @@ export class HsDrawService {
*/
async fillDrawableLayers(): Promise<void> {
let drawables = [];
this.HsMapService.loaded().then(() => {
drawables = this.HsMapService.map
.getLayers()
.getArray()
.filter((layer) => this.HsLayerUtilsService.isLayerDrawable(layer));
});
await this.HsMapService.loaded();
drawables = this.HsMapService.map
.getLayers()
.getArray()
.filter((layer) => this.HsLayerUtilsService.isLayerDrawable(layer));

if (drawables.length == 0 && !this.tmpDrawLayer) {
this.type = null;
Expand Down

0 comments on commit ccc705c

Please sign in to comment.