@artstesh/maps 4.1.17 → 4.1.18
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.
- package/dist/esm2020/map/map-plate/map-plate.factory.service.mjs +3 -1
- package/dist/esm2020/map/models/map-settings.mjs +15 -1
- package/dist/esm2020/src/map/map-plate/map-plate.factory.service.mjs +3 -1
- package/dist/esm2020/src/map/models/map-settings.mjs +15 -1
- package/dist/fesm2015/maps-components-src-map.mjs +16 -1
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +16 -1
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +16 -1
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +16 -1
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/models/map-settings.d.ts +10 -0
- package/dist/package.json +1 -1
- package/dist/src/map/models/map-settings.d.ts +10 -0
- package/package.json +2 -2
|
@@ -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({ ...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
|
}
|
|
@@ -1983,6 +1997,7 @@ class MapPlateFactory {
|
|
|
1983
1997
|
maxZoom: settings?.maxZoom || 19,
|
|
1984
1998
|
}),
|
|
1985
1999
|
layers: [],
|
|
2000
|
+
interactions: defaults(settings.interactionSettings),
|
|
1986
2001
|
});
|
|
1987
2002
|
}
|
|
1988
2003
|
}
|