@@ -82,6 +82,7 @@ export default class ReactSVGPanZoom extends React.Component {
82
82
defaultValue
83
83
}
84
84
this . autoPanLoop = this . autoPanLoop . bind ( this ) ;
85
+ this . onWheel = this . onWheel . bind ( this ) ;
85
86
86
87
if ( process . env . NODE_ENV !== 'production' ) {
87
88
printMigrationTipsRelatedToProps ( props )
@@ -145,10 +146,12 @@ export default class ReactSVGPanZoom extends React.Component {
145
146
componentDidMount ( ) {
146
147
this . autoPanIsRunning = true ;
147
148
requestAnimationFrame ( this . autoPanLoop ) ;
149
+ this . ViewerDOM . addEventListener ( 'wheel' , this . onWheel , false ) ;
148
150
}
149
151
150
152
componentWillUnmount ( ) {
151
153
this . autoPanIsRunning = false ;
154
+ this . ViewerDOM . removeEventListener ( 'wheel' , this . onWheel ) ;
152
155
}
153
156
154
157
/** ReactSVGPanZoom handlers **/
@@ -257,6 +260,11 @@ export default class ReactSVGPanZoom extends React.Component {
257
260
}
258
261
}
259
262
263
+ onWheel ( event ) {
264
+ let nextValue = onWheel ( event , this . ViewerDOM , this . getTool ( ) , this . getValue ( ) , this . props ) ;
265
+ if ( this . getValue ( ) !== nextValue ) this . setValue ( nextValue ) ;
266
+ }
267
+
260
268
/** React renderer **/
261
269
render ( ) {
262
270
let { props, state : { pointerX, pointerY} } = this ;
@@ -330,11 +338,6 @@ export default class ReactSVGPanZoom extends React.Component {
330
338
this . handleViewerEvent ( event ) ;
331
339
} }
332
340
333
- onWheel = { event => {
334
- let nextValue = onWheel ( event , this . ViewerDOM , this . getTool ( ) , this . getValue ( ) , this . props ) ;
335
- if ( this . getValue ( ) !== nextValue ) this . setValue ( nextValue ) ;
336
- } }
337
-
338
341
onMouseEnter = { event => {
339
342
if ( detectTouch ( ) ) return ;
340
343
let nextValue = onMouseEnterOrLeave ( event , this . ViewerDOM , this . getTool ( ) , this . getValue ( ) , this . props ) ;
0 commit comments