Skip to content

Commit 58a1ce8

Browse files
committed
chore(core): cleanup async functions
Signed-off-by: braks <[email protected]>
1 parent 4b2a978 commit 58a1ce8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/core/src/composables/useZoomPanHelper.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ export default (vueFlowId?: string): ViewportFunctions => {
1111
$(useVueFlow({ id: vueFlowId }))
1212

1313
return {
14-
zoomIn: async (options) => {
15-
await zoom(1.2, options?.duration)
14+
zoomIn: (options) => {
15+
zoom(1.2, options?.duration)
1616
},
17-
zoomOut: async (options) => {
18-
await zoom(1 / 1.2, options?.duration)
17+
zoomOut: (options) => {
18+
zoom(1 / 1.2, options?.duration)
1919
},
20-
zoomTo: async (zoomLevel, options) => {
20+
zoomTo: (zoomLevel, options) => {
2121
if (d3Selection && d3Zoom) {
2222
d3Zoom.scaleTo(transition(d3Selection, options?.duration), zoomLevel)
2323
}
2424
},
25-
setTransform: async (transform, options) => {
25+
setTransform: (transform, options) => {
2626
transformViewport(transform.x, transform.y, transform.zoom, options?.duration)
2727
},
2828
getTransform: () => ({
2929
x: viewport.x,
3030
y: viewport.y,
3131
zoom: viewport.zoom,
3232
}),
33-
fitView: async (
33+
fitView: (
3434
options = {
3535
padding: DEFAULT_PADDING,
3636
includeHiddenNodes: false,
@@ -64,22 +64,22 @@ export default (vueFlowId?: string): ViewportFunctions => {
6464

6565
transformViewport(x, y, zoom, options?.duration)
6666
},
67-
setCenter: async (x, y, options) => {
67+
setCenter: (x, y, options) => {
6868
const nextZoom = typeof options?.zoom !== 'undefined' ? options.zoom : maxZoom
6969
const centerX = dimensions.width / 2 - x * nextZoom
7070
const centerY = dimensions.height / 2 - y * nextZoom
7171

7272
transformViewport(centerX, centerY, nextZoom, options?.duration)
7373
},
74-
fitBounds: async (bounds, options = { padding: DEFAULT_PADDING }) => {
74+
fitBounds: (bounds, options = { padding: DEFAULT_PADDING }) => {
7575
const { x, y, zoom } = getTransformForBounds(bounds, dimensions.width, dimensions.height, minZoom, maxZoom, options.padding)
7676

7777
transformViewport(x, y, zoom, options?.duration)
7878
},
7979
project: (position) => pointToRendererPoint(position, viewport, snapToGrid, snapGrid),
8080
}
8181

82-
async function zoom(scale: number, duration?: number) {
82+
function zoom(scale: number, duration?: number) {
8383
if (d3Selection && d3Zoom) {
8484
d3Zoom.scaleBy(transition(d3Selection, duration), scale)
8585
}

0 commit comments

Comments
 (0)