File tree Expand file tree Collapse file tree 1 file changed +10
-16
lines changed Expand file tree Collapse file tree 1 file changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -90,22 +90,16 @@ const Zoom = (props: Pick<ISTKProps, "mode" | "styles" | "options">) => {
9090 if ( selectedTool == Tool . Pan ) {
9191 selection . call ( zoom ) ;
9292 } else {
93- selection
94- . call ( zoom )
95- . on ( "mousedown.zoom" , null )
96- . on ( "touchstart.zoom" , null )
97- . on ( "touchmove.zoom" , null )
98- . on ( "touchend.zoom" , null )
99- . on ( "wheel.zoom" , ( e ) => {
100- e . preventDefault ( ) ;
101- const currentZoom = selection . property ( "__zoom" ) . k || 1 ;
102- if ( e . ctrlKey ) {
103- const nextZoom = currentZoom * Math . pow ( 2 , - e . deltaY * 0.01 ) ;
104- zoom . scaleTo ( selection , nextZoom , d3Extended . pointer ( e ) ) ;
105- } else {
106- zoom . translateBy ( selection , - ( e . deltaX / currentZoom ) , - ( e . deltaY / currentZoom ) ) ;
107- }
108- } ) ;
93+ selection . call ( zoom ) . on ( "wheel.zoom" , ( e ) => {
94+ e . preventDefault ( ) ;
95+ const currentZoom = selection . property ( "__zoom" ) . k || 1 ;
96+ if ( e . ctrlKey ) {
97+ const nextZoom = currentZoom * Math . pow ( 2 , - e . deltaY * 0.01 ) ;
98+ zoom . scaleTo ( selection , nextZoom , d3Extended . pointer ( e ) ) ;
99+ } else {
100+ zoom . translateBy ( selection , - ( e . deltaX / currentZoom ) , - ( e . deltaY / currentZoom ) ) ;
101+ }
102+ } ) ;
109103 }
110104 } , [ selectedTool ] ) ;
111105
You can’t perform that action at this time.
0 commit comments