@evergis/react 2.0.84 → 2.0.85
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/hooks/useMapViewActions.d.ts +1 -0
- package/dist/react.cjs.development.js +15 -1
- package/dist/react.cjs.development.js.map +1 -1
- package/dist/react.cjs.production.min.js +1 -1
- package/dist/react.cjs.production.min.js.map +1 -1
- package/dist/react.esm.js +15 -1
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -6,6 +6,7 @@ export declare function useMapViewActions(): {
|
|
|
6
6
|
zoomOut: () => void;
|
|
7
7
|
zoomAround: (event: sGisClickEvent) => void;
|
|
8
8
|
animateTo: ({ position, resolution, extent }: AnimateToParams) => void;
|
|
9
|
+
changeZoomLevel: (level: number) => void;
|
|
9
10
|
};
|
|
10
11
|
declare type AnimateToParams = {
|
|
11
12
|
position?: Coordinates;
|
|
@@ -382,12 +382,26 @@ function useMapViewActions() {
|
|
|
382
382
|
const zoomAround = React.useCallback(event => {
|
|
383
383
|
map.zoom(1, getEventPoint(event));
|
|
384
384
|
}, [getEventPoint, map]);
|
|
385
|
+
const changeZoomLevel = React.useCallback(level => {
|
|
386
|
+
const {
|
|
387
|
+
tileScheme
|
|
388
|
+
} = map;
|
|
389
|
+
let tileLevel = tileScheme.levels.find((_ref2) => {
|
|
390
|
+
let {
|
|
391
|
+
zIndex
|
|
392
|
+
} = _ref2;
|
|
393
|
+
return zIndex === level;
|
|
394
|
+
});
|
|
395
|
+
const resolution = tileLevel ? tileLevel.resolution : map.resolution;
|
|
396
|
+
map.animateSetResolution(resolution, map.position);
|
|
397
|
+
}, [map]);
|
|
385
398
|
return {
|
|
386
399
|
zoomTo,
|
|
387
400
|
zoomIn,
|
|
388
401
|
zoomOut,
|
|
389
402
|
zoomAround,
|
|
390
|
-
animateTo
|
|
403
|
+
animateTo,
|
|
404
|
+
changeZoomLevel
|
|
391
405
|
};
|
|
392
406
|
}
|
|
393
407
|
|