@igo2/integration 1.13.2 → 1.13.3

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.
@@ -919,17 +919,24 @@ IgoAppDirectionsModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [I
919
919
  class DrawState {
920
920
  constructor(mapState) {
921
921
  this.mapState = mapState;
922
- /**
923
- * Store that holds the measures
924
- */
925
- this.store = new FeatureStore([], {
926
- map: this.mapState.map
927
- });
922
+ this.stores = [];
923
+ this.layersID = [];
924
+ this.drawControls = [];
928
925
  this.mapState.map.layers$.subscribe(() => {
929
- if (!this.mapState.map.getLayerById('igo-draw-layer')) {
930
- this.store.deleteMany(this.store.all());
931
- }
926
+ this.layersID.forEach(layerId => {
927
+ if (!this.mapState.map.getLayerById(layerId)) {
928
+ let deletedStore = this.stores.find(store => store.layer.id === layerId);
929
+ deletedStore.deleteMany(deletedStore.all());
930
+ this.stores.splice(this.stores.indexOf(deletedStore, 0), 1);
931
+ this.layersID.splice(this.layersID.indexOf(layerId, 0), 1);
932
+ let drawControlIndex = this.drawControls.findIndex(dc => dc[0] === layerId);
933
+ this.drawControls.splice(drawControlIndex, 1);
934
+ }
935
+ });
932
936
  });
937
+ for (let store of this.stores) {
938
+ store = new FeatureStore([], { map: this.mapState.map });
939
+ }
933
940
  }
934
941
  }
935
942
  DrawState.ɵfac = function DrawState_Factory(t) { return new (t || DrawState)(i0.ɵɵinject(MapState)); };
@@ -953,18 +960,45 @@ let DrawingToolComponent = class DrawingToolComponent {
953
960
  * Map to measure on
954
961
  * @internal
955
962
  */
956
- get store() { return this.drawState.store; }
963
+ get stores() {
964
+ return this.drawState.stores;
965
+ }
957
966
  /**
958
967
  * Map to measure on
959
968
  * @internal
960
969
  */
961
- get map() { return this.mapState.map; }
970
+ get map() {
971
+ return this.mapState.map;
972
+ }
973
+ get layersID() {
974
+ return this.drawState.layersID;
975
+ }
976
+ get drawControls() {
977
+ return this.drawState.drawControls;
978
+ }
979
+ set drawControls(dc) {
980
+ this.drawState.drawControls = dc;
981
+ }
982
+ get activeDrawingLayer() {
983
+ return this.drawState.activeDrawingLayer;
984
+ }
985
+ set activeDrawingLayer(value) {
986
+ this.drawState.activeDrawingLayer = value;
987
+ }
988
+ addLayersID(layerID) {
989
+ this.layersID.push(layerID);
990
+ }
991
+ addDrawControls(dc) {
992
+ this.drawControls = dc;
993
+ }
962
994
  };
963
995
  DrawingToolComponent.ɵfac = function DrawingToolComponent_Factory(t) { return new (t || DrawingToolComponent)(i0.ɵɵdirectiveInject(DrawState), i0.ɵɵdirectiveInject(MapState)); };
964
- DrawingToolComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DrawingToolComponent, selectors: [["igo-drawing-tool"]], decls: 1, vars: 2, consts: [[3, "store", "map"]], template: function DrawingToolComponent_Template(rf, ctx) { if (rf & 1) {
965
- i0.ɵɵelement(0, "igo-draw", 0);
996
+ DrawingToolComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DrawingToolComponent, selectors: [["igo-drawing-tool"]], decls: 1, vars: 4, consts: [[3, "stores", "map", "activeDrawingLayer", "drawControls", "layersIDEvent", "drawControlsEvent", "activeLayerChange"]], template: function DrawingToolComponent_Template(rf, ctx) { if (rf & 1) {
997
+ i0.ɵɵelementStart(0, "igo-draw", 0);
998
+ i0.ɵɵlistener("layersIDEvent", function DrawingToolComponent_Template_igo_draw_layersIDEvent_0_listener($event) { return ctx.addLayersID($event); })("drawControlsEvent", function DrawingToolComponent_Template_igo_draw_drawControlsEvent_0_listener($event) { return ctx.addDrawControls($event); })("activeLayerChange", function DrawingToolComponent_Template_igo_draw_activeLayerChange_0_listener($event) { return ctx.activeDrawingLayer = $event; });
999
+ i0.ɵɵelementEnd();
966
1000
  } if (rf & 2) {
967
- i0.ɵɵproperty("store", ctx.store)("map", ctx.map);
1001
+ i0.ɵɵproperty("stores", ctx.stores)("map", ctx.map)("activeDrawingLayer", ctx.activeDrawingLayer)("drawControls", ctx.drawControls);
968
1002
  } }, dependencies: [i1$1.DrawComponent], encapsulation: 2, changeDetection: 0 });
969
1003
  DrawingToolComponent = __decorate([
970
1004
  ToolComponent({
@@ -975,7 +1009,7 @@ DrawingToolComponent = __decorate([
975
1009
  ], DrawingToolComponent);
976
1010
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DrawingToolComponent, [{
977
1011
  type: Component,
978
- args: [{ selector: 'igo-drawing-tool', changeDetection: ChangeDetectionStrategy.OnPush, template: "<igo-draw [store]=\"store\" [map]=\"map\"></igo-draw>\r\n" }]
1012
+ args: [{ selector: 'igo-drawing-tool', changeDetection: ChangeDetectionStrategy.OnPush, template: "<igo-draw\r\n [stores]=\"stores\"\r\n [map]=\"map\"\r\n (layersIDEvent)=\"addLayersID($event)\"\r\n [activeDrawingLayer]=\"activeDrawingLayer\"\r\n [drawControls]=\"drawControls\"\r\n (drawControlsEvent)=\"addDrawControls($event)\"\r\n (activeLayerChange)=\"activeDrawingLayer = $event\">\r\n</igo-draw>\r\n" }]
979
1013
  }], function () { return [{ type: DrawState }, { type: MapState }]; }, null); })();
980
1014
 
981
1015
  class IgoAppDrawModule {