@evergis/react
Advanced tools
Comparing version 0.1.12 to 0.1.13
@@ -10,3 +10,3 @@ "use strict"; | ||
const levels = map.tileScheme.levels; | ||
if (maxScale) { | ||
if (maxScale !== undefined) { | ||
const { resolution } = levels.find(byScale(maxScale)) || { | ||
@@ -17,3 +17,3 @@ resolution: -1, | ||
} | ||
if (minScale) { | ||
if (minScale !== undefined) { | ||
const { resolution } = levels.find(byScale(minScale)) || { | ||
@@ -24,4 +24,9 @@ resolution: -1, | ||
} | ||
exports.updateMapResolution(map); | ||
}, [map, minScale, maxScale]); | ||
}; | ||
exports.updateMapResolution = (map) => { | ||
const newResolution = Math.min(Math.max(map.resolution, map.minResolution || 0), map.maxResolution || Number.MAX_VALUE); | ||
map.animateTo(map.position, newResolution); | ||
}; | ||
//# sourceMappingURL=useMaxMinScale.js.map |
@@ -0,1 +1,3 @@ | ||
import { Map } from '@evergis/sgis/es/Map'; | ||
export declare const useMaxMinScale: (minScale?: number | undefined, maxScale?: number | undefined) => void; | ||
export declare const updateMapResolution: (map: Map) => void; |
@@ -8,3 +8,3 @@ import { useEffect } from 'react'; | ||
const levels = map.tileScheme.levels; | ||
if (maxScale) { | ||
if (maxScale !== undefined) { | ||
const { resolution } = levels.find(byScale(maxScale)) || { | ||
@@ -15,3 +15,3 @@ resolution: -1, | ||
} | ||
if (minScale) { | ||
if (minScale !== undefined) { | ||
const { resolution } = levels.find(byScale(minScale)) || { | ||
@@ -22,4 +22,9 @@ resolution: -1, | ||
} | ||
updateMapResolution(map); | ||
}, [map, minScale, maxScale]); | ||
}; | ||
export const updateMapResolution = (map) => { | ||
const newResolution = Math.min(Math.max(map.resolution, map.minResolution || 0), map.maxResolution || Number.MAX_VALUE); | ||
map.animateTo(map.position, newResolution); | ||
}; | ||
//# sourceMappingURL=useMaxMinScale.js.map |
{ | ||
"name": "@evergis/react", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "React components for creating GIS apps with evergis server", | ||
@@ -5,0 +5,0 @@ "author": "everpoint", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89715
1162