@@ -143,6 +143,7 @@ mpl.figure.prototype._init_canvas = function() {
143
143
// Throttle sequential mouse events to 1 every 20ms.
144
144
rubberband . mousemove ( 'motion_notify' , mouse_event_fn ) ;
145
145
146
+ < << << << HEAD
146
147
rubberband . mouseenter ( 'figure_enter' , mouse_event_fn ) ;
147
148
rubberband . mouseleave ( 'figure_leave' , mouse_event_fn ) ;
148
149
@@ -152,6 +153,31 @@ mpl.figure.prototype._init_canvas = function() {
152
153
event . step = event . deltaY / 3.
153
154
mouse_event_fn ( event ) ;
154
155
} ) ;
156
+ = === ===
157
+
158
+ rubberband . mouseenter ( 'figure_enter' , mouse_event_fn ) ;
159
+ rubberband . mouseleave ( 'figure_leave' , mouse_event_fn ) ;
160
+
161
+ function scroll_fn ( event ) {
162
+ event [ 'data' ] = 'scroll'
163
+ // http://www.adomas.org/javascript-mouse-wheel/
164
+ if ( event . wheelDelta ) { /* IE/Opera. */
165
+ event . step = event . wheelDelta / 120 ;
166
+ } else if ( event . detail ) { /** Mozilla case. */
167
+ /** In Mozilla, sign of delta is different than in IE.
168
+ * Also, delta is multiple of 3.
169
+ */
170
+ event . step = - event . detail / 3 ;
171
+ }
172
+ mouse_event_fn ( event )
173
+ }
174
+ // Initialization code.
175
+ if ( window . addEventListener )
176
+ /** DOMMouseScroll is for mozilla. */
177
+ window . addEventListener ( 'DOMMouseScroll' , scroll_fn , false ) ;
178
+ /** IE/Opera. */
179
+ window . onmousewheel = document . onmousewheel = scroll_fn ;
180
+ > >>> >>> fe99b32 . . . Add scroll event handling to webagg backend
155
181
156
182
canvas_div . append ( canvas ) ;
157
183
canvas_div . append ( rubberband ) ;
0 commit comments