update(zoom): clamp transform values
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -190,7 +190,16 @@ watch(
|
|||||||
},
|
},
|
||||||
{ flush: 'pre' },
|
{ flush: 'pre' },
|
||||||
)
|
)
|
||||||
watch(transform, (val) => (store.transform = [val.x, val.y, val.zoom]), { flush: 'pre' })
|
watch(
|
||||||
|
transform,
|
||||||
|
(val) =>
|
||||||
|
(store.transform = [
|
||||||
|
clamp(val.x, store.translateExtent[0][0], store.translateExtent[1][0]),
|
||||||
|
clamp(val.y, store.translateExtent[0][0], store.translateExtent[1][0]),
|
||||||
|
clamp(val.zoom, store.translateExtent[0][0], store.translateExtent[1][0]),
|
||||||
|
]),
|
||||||
|
{ flush: 'pre' },
|
||||||
|
)
|
||||||
|
|
||||||
const { zoomIn, zoomOut, zoomTo, transform: setTransform, fitView } = useZoomPanHelper()
|
const { zoomIn, zoomOut, zoomTo, transform: setTransform, fitView } = useZoomPanHelper()
|
||||||
watchOnce(
|
watchOnce(
|
||||||
|
|||||||
Reference in New Issue
Block a user