@@ -11,26 +11,26 @@ export default (vueFlowId?: string): ViewportFunctions => {
11
11
$ ( useVueFlow ( { id : vueFlowId } ) )
12
12
13
13
return {
14
- zoomIn : async ( options ) => {
15
- await zoom ( 1.2 , options ?. duration )
14
+ zoomIn : ( options ) => {
15
+ zoom ( 1.2 , options ?. duration )
16
16
} ,
17
- zoomOut : async ( options ) => {
18
- await zoom ( 1 / 1.2 , options ?. duration )
17
+ zoomOut : ( options ) => {
18
+ zoom ( 1 / 1.2 , options ?. duration )
19
19
} ,
20
- zoomTo : async ( zoomLevel , options ) => {
20
+ zoomTo : ( zoomLevel , options ) => {
21
21
if ( d3Selection && d3Zoom ) {
22
22
d3Zoom . scaleTo ( transition ( d3Selection , options ?. duration ) , zoomLevel )
23
23
}
24
24
} ,
25
- setTransform : async ( transform , options ) => {
25
+ setTransform : ( transform , options ) => {
26
26
transformViewport ( transform . x , transform . y , transform . zoom , options ?. duration )
27
27
} ,
28
28
getTransform : ( ) => ( {
29
29
x : viewport . x ,
30
30
y : viewport . y ,
31
31
zoom : viewport . zoom ,
32
32
} ) ,
33
- fitView : async (
33
+ fitView : (
34
34
options = {
35
35
padding : DEFAULT_PADDING ,
36
36
includeHiddenNodes : false ,
@@ -64,22 +64,22 @@ export default (vueFlowId?: string): ViewportFunctions => {
64
64
65
65
transformViewport ( x , y , zoom , options ?. duration )
66
66
} ,
67
- setCenter : async ( x , y , options ) => {
67
+ setCenter : ( x , y , options ) => {
68
68
const nextZoom = typeof options ?. zoom !== 'undefined' ? options . zoom : maxZoom
69
69
const centerX = dimensions . width / 2 - x * nextZoom
70
70
const centerY = dimensions . height / 2 - y * nextZoom
71
71
72
72
transformViewport ( centerX , centerY , nextZoom , options ?. duration )
73
73
} ,
74
- fitBounds : async ( bounds , options = { padding : DEFAULT_PADDING } ) => {
74
+ fitBounds : ( bounds , options = { padding : DEFAULT_PADDING } ) => {
75
75
const { x, y, zoom } = getTransformForBounds ( bounds , dimensions . width , dimensions . height , minZoom , maxZoom , options . padding )
76
76
77
77
transformViewport ( x , y , zoom , options ?. duration )
78
78
} ,
79
79
project : ( position ) => pointToRendererPoint ( position , viewport , snapToGrid , snapGrid ) ,
80
80
}
81
81
82
- async function zoom ( scale : number , duration ?: number ) {
82
+ function zoom ( scale : number , duration ?: number ) {
83
83
if ( d3Selection && d3Zoom ) {
84
84
d3Zoom . scaleBy ( transition ( d3Selection , duration ) , scale )
85
85
}
0 commit comments