File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
lib/matplotlib/backends/web_backend Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,27 @@ mpl.figure.prototype._init_canvas = function() {
142
142
// Throttle sequential mouse events to 1 every 20ms.
143
143
rubberband . mousemove ( 'motion_notify' , mouse_event_fn ) ;
144
144
145
+ < << << << HEAD
145
146
rubberband . mouseenter ( 'figure_enter' , mouse_event_fn ) ;
146
147
rubberband . mouseleave ( 'figure_leave' , mouse_event_fn ) ;
148
+ = === ===
149
+ function scroll_fn ( event ) {
150
+ event [ 'data' ] = 'scroll'
151
+ // http://www.adomas.org/javascript-mouse-wheel/
152
+ if ( event . wheelDelta ) { /* IE/Opera. */
153
+ event . step = event . wheelDelta / 120 ;
154
+ } else if ( event . detail ) { /** Mozilla case. */
155
+ /** In Mozilla, sign of delta is different than in IE.
156
+ * Also, delta is multiple of 3.
157
+ */
158
+ event . step = - event . detail / 3 ;
159
+ }
160
+ mouse_event_fn ( event ) ;
161
+ }
162
+
163
+ $ ( canvas_div ) [ 0 ] . addEventListener ( 'DOMMouseScroll' , scroll_fn , false ) ;
164
+ $ ( canvas_div ) [ 0 ] . addEventListener ( 'mousewheel' , scroll_fn , false ) ;
165
+ > >>> >>> 2335705. . . Remove debug prints
147
166
148
167
canvas_div . append ( canvas ) ;
149
168
canvas_div . append ( rubberband ) ;
You can’t perform that action at this time.
0 commit comments