chore(nodewrapper): cleanup

This commit is contained in:
moklick
2025-06-05 16:28:02 +02:00
parent 59eb0df26e
commit d434f0cde7
6 changed files with 30 additions and 41 deletions
+1 -19
View File
@@ -63,25 +63,7 @@ const useViewportHelper = (): ViewportHelperFunctions => {
return { x, y, zoom };
},
setCenter: async (x, y, options) => {
const { width, height, maxZoom, panZoom } = store.getState();
const nextZoom = typeof options?.zoom !== 'undefined' ? options.zoom : maxZoom;
const centerX = width / 2 - x * nextZoom;
const centerY = height / 2 - y * nextZoom;
if (!panZoom) {
return Promise.resolve(false);
}
await panZoom.setViewport(
{
x: centerX,
y: centerY,
zoom: nextZoom,
},
{ duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate }
);
return Promise.resolve(true);
return store.getState().setCenter(x, y, options);
},
fitBounds: async (bounds, options) => {
const { width, height, minZoom, maxZoom, panZoom } = store.getState();