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
+20
View File
@@ -360,6 +360,26 @@ const createStore = ({
return panBySystem({ delta, panZoom, transform, translateExtent, width, height });
},
setCenter: async (x, y, options) => {
const { width, height, maxZoom, panZoom } = get();
if (!panZoom) {
return Promise.resolve(false);
}
const nextZoom = typeof options?.zoom !== 'undefined' ? options.zoom : maxZoom;
await panZoom.setViewport(
{
x: width / 2 - x * nextZoom,
y: height / 2 - y * nextZoom,
zoom: nextZoom,
},
{ duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate }
);
return Promise.resolve(true);
},
cancelConnection: () => {
set({
connection: { ...initialConnection },