@artstesh/maps 1.1.16 → 1.1.17

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.
@@ -9,7 +9,7 @@ import { getCenter, createEmpty, extend } from 'ol/extent';
9
9
  import { Control, Zoom } from 'ol/control';
10
10
  import { get, useGeographic, transform } from 'ol/proj';
11
11
  import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
12
- import { Draw, Modify, Translate } from 'ol/interaction';
12
+ import { Draw, Modify, Translate, defaults } from 'ol/interaction';
13
13
  import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
14
14
  import * as Sphere from 'ol/sphere';
15
15
  import { Dictionary } from '@artstesh/collections';
@@ -77,6 +77,7 @@ class MapSettings {
77
77
  this.zoom = 4;
78
78
  this.lyrs = MapLyrs.Hybrid;
79
79
  this.language = 'en';
80
+ this.interactionSettings = {};
80
81
  }
81
82
  static copy(model) {
82
83
  const result = new MapSettings();
@@ -85,9 +86,20 @@ class MapSettings {
85
86
  result.minZoom = model.minZoom;
86
87
  result.zoom = model.zoom;
87
88
  result.lyrs = model.lyrs;
89
+ result.interactionSettings = model.interactionSettings;
88
90
  result.language = model.language;
89
91
  return result;
90
92
  }
93
+ /**
94
+ * Updates the interaction settings of the map and returns a new MapSettings instance
95
+ * with the updated settings.
96
+ *
97
+ * @param {DefaultsOptions} interactionSettings - The new interaction settings to be applied.
98
+ * @return {MapSettings} A new MapSettings instance with the updated interaction settings.
99
+ */
100
+ setInteractionSettings(interactionSettings) {
101
+ return MapSettings.copy(Object.assign(Object.assign({}, this), { interactionSettings }));
102
+ }
91
103
  /**
92
104
  * Sets the center for the map settings.
93
105
  *
@@ -159,6 +171,8 @@ class MapSettings {
159
171
  return false;
160
172
  if (this.language !== model.language)
161
173
  return false;
174
+ if (this.interactionSettings !== model.interactionSettings)
175
+ return false;
162
176
  return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
163
177
  }
164
178
  }
@@ -2024,6 +2038,7 @@ class MapPlateFactory {
2024
2038
  maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
2025
2039
  }),
2026
2040
  layers: [],
2041
+ interactions: defaults(settings.interactionSettings),
2027
2042
  });
2028
2043
  }
2029
2044
  }