@igo2/geo 21.0.0-next.30 → 21.0.0-next.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23676,8 +23676,10 @@ class DrawComponent {
23676
23676
  }
23677
23677
  }
23678
23678
  else {
23679
- const drawingLayer = this.activeDrawingLayer();
23680
- this.activeStore = this.stores().find((store) => store.layer.id === drawingLayer?.id);
23679
+ const activeStore = this.stores().find((store) => store.layer.id === this.activeDrawingLayer()?.id) ?? this.stores()[0];
23680
+ this.activeStore = activeStore;
23681
+ const drawingLayer = this.activeDrawingLayer() ?? activeStore.layer;
23682
+ this.activeDrawingLayer.set(drawingLayer);
23681
23683
  this.activeDrawControl = this.drawControls()?.find((dc) => dc[0] === drawingLayer?.id)?.[1];
23682
23684
  this.deactivateDrawControl();
23683
23685
  this.allLayers.forEach((layer) => {
@@ -23715,16 +23717,10 @@ class DrawComponent {
23715
23717
  });
23716
23718
  }
23717
23719
  /**
23718
- * Remove the drawing layer and the interactions
23720
+ * Remove drawing interactions while retaining drawing layers between tab visits.
23719
23721
  * @internal
23720
23722
  */
23721
23723
  ngOnDestroy() {
23722
- if (this.activeStore.count === 0) {
23723
- const drawingLayer = this.activeDrawingLayer();
23724
- if (drawingLayer) {
23725
- this.activeStore.map.layerController.remove(drawingLayer);
23726
- }
23727
- }
23728
23724
  this.allLayers.forEach((layer) => (layer.opacity = 1));
23729
23725
  this.activeStore.state.updateAll({ selected: false });
23730
23726
  this.deactivateDrawControl();
@@ -24024,49 +24020,46 @@ class DrawComponent {
24024
24020
  });
24025
24021
  }
24026
24022
  setupLayer(isNewLayer) {
24027
- setTimeout(() => {
24028
- const dialogRef = this.dialog.open(DrawLayerPopupComponent, {
24029
- disableClose: false
24030
- });
24031
- dialogRef.afterClosed().subscribe((label) => {
24032
- if (dialogRef.componentInstance.confirmFlag()) {
24033
- this.activeStore.state.updateAll({ selected: false });
24034
- this.activeStore = new FeatureStore([], {
24035
- map: this.map()
24036
- });
24037
- this.activeDrawingLayerSource = new OlVectorSource();
24038
- const activeDrawingLayer = this.activeDrawingLayer();
24039
- if (activeDrawingLayer) {
24040
- activeDrawingLayer.opacity = 0;
24041
- }
24042
- this.deactivateDrawControl();
24043
- this.initStore(label, isNewLayer);
24044
- this.activeDrawControl = this.createDrawControl(this.fillColor, this.strokeColor, this.strokeWidth);
24045
- this.activeDrawControl?.setGeometryType(this.currGeometryType);
24046
- this.toggleDrawControl();
24047
- this.stores.update((stores) => stores.concat(this.activeStore));
24048
- if (activeDrawingLayer) {
24049
- this.drawControls.update((controls) => controls.concat([
24050
- [activeDrawingLayer.id, this.activeDrawControl]
24051
- ]));
24052
- this.drawControlsEvent.emit(this.drawControls());
24053
- this.layersIDEvent.emit(activeDrawingLayer.id);
24054
- }
24055
- this.isCreatingNewLayer = false;
24056
- if (!this.labelsAreShown) {
24057
- this.onToggleLabels();
24058
- }
24059
- this.activeLayerChange.emit(activeDrawingLayer);
24023
+ const dialogRef = this.dialog.open(DrawLayerPopupComponent, {
24024
+ disableClose: false
24025
+ });
24026
+ dialogRef.afterClosed().subscribe((label) => {
24027
+ if (dialogRef.componentInstance.confirmFlag()) {
24028
+ this.activeStore.state.updateAll({ selected: false });
24029
+ this.activeStore = new FeatureStore([], {
24030
+ map: this.map()
24031
+ });
24032
+ this.activeDrawingLayerSource = new OlVectorSource();
24033
+ const previousDrawingLayer = this.activeDrawingLayer();
24034
+ if (previousDrawingLayer) {
24035
+ previousDrawingLayer.opacity = 0;
24060
24036
  }
24061
- else {
24062
- const select = this.select();
24063
- if (select) {
24064
- select.value = this.activeDrawingLayer;
24065
- select.selectionChange.emit(new MatSelectChange(select, this.activeDrawingLayer()));
24066
- }
24037
+ this.deactivateDrawControl();
24038
+ this.initStore(label, isNewLayer);
24039
+ const drawingLayer = this.activeDrawingLayer();
24040
+ this.activeDrawControl = this.createDrawControl(this.fillColor, this.strokeColor, this.strokeWidth);
24041
+ this.activeDrawControl?.setGeometryType(this.currGeometryType);
24042
+ this.toggleDrawControl();
24043
+ this.stores.update((stores) => stores.concat(this.activeStore));
24044
+ if (drawingLayer) {
24045
+ this.drawControls.update((controls) => controls.concat([[drawingLayer.id, this.activeDrawControl]]));
24046
+ this.drawControlsEvent.emit(this.drawControls());
24047
+ this.layersIDEvent.emit(drawingLayer.id);
24048
+ }
24049
+ this.isCreatingNewLayer = false;
24050
+ if (!this.labelsAreShown) {
24051
+ this.onToggleLabels();
24052
+ }
24053
+ this.activeLayerChange.emit(drawingLayer);
24054
+ }
24055
+ else {
24056
+ const select = this.select();
24057
+ if (select) {
24058
+ select.value = this.activeDrawingLayer;
24059
+ select.selectionChange.emit(new MatSelectChange(select, this.activeDrawingLayer()));
24067
24060
  }
24068
- });
24069
- }, 250);
24061
+ }
24062
+ });
24070
24063
  }
24071
24064
  // HTML user interactions
24072
24065
  /**