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() {
142142 // Throttle sequential mouse events to 1 every 20ms.
143143 rubberband . mousemove ( 'motion_notify' , mouse_event_fn ) ;
144144
145+ < << << << HEAD
145146 rubberband . mouseenter ( 'figure_enter' , mouse_event_fn ) ;
146147 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
147166
148167 canvas_div . append ( canvas ) ;
149168 canvas_div . append ( rubberband ) ;
You can’t perform that action at this time.
0 commit comments