1
1
var VispyCanvas = require ( './vispycanvas.js' ) ;
2
2
var screenfull = require ( "screenfull" ) ;
3
- var mousewheel = require ( "jquery-mousewheel" ) ;
3
+ require ( 'jquery' ) ;
4
+ require ( 'jquery-ui/ui/widgets/resizable' ) ;
4
5
5
6
/* Internal functions */
6
7
function get_pos ( c , e ) {
@@ -381,7 +382,7 @@ function init_app(c) {
381
382
382
383
// Generate a resize event when the user resizes the canvas with
383
384
// jQuery resizable.
384
- c . $el . resize ( function ( e ) {
385
+ c . $el . on ( "resize" , function ( e ) {
385
386
c . resize ( [ e . width ( ) , e . height ( ) ] ) ;
386
387
}
387
388
) ;
@@ -407,7 +408,7 @@ function init_app(c) {
407
408
// button is pressed, or the left button is pressed.
408
409
c . _eventinfo . is_button_pressed = 0 ;
409
410
410
- c . $el . mousemove ( function ( e ) {
411
+ c . $el . on ( "mousemove" , function ( e ) {
411
412
var event = gen_mouse_event ( c , e , 'mouse_move' ) ;
412
413
413
414
// Vispy callbacks.
@@ -417,7 +418,7 @@ function init_app(c) {
417
418
// c._eventinfo.last_event = event;
418
419
c . event_queue . append ( event ) ;
419
420
} ) ;
420
- c . $el . mousedown ( function ( e ) {
421
+ c . $el . on ( "mousedown" , function ( e ) {
421
422
++ c . _eventinfo . is_button_pressed ;
422
423
var event = gen_mouse_event ( c , e , 'mouse_press' ) ;
423
424
@@ -430,7 +431,7 @@ function init_app(c) {
430
431
// c._eventinfo.last_event = event;
431
432
c . event_queue . append ( event ) ;
432
433
} ) ;
433
- c . $el . mouseup ( function ( e ) {
434
+ c . $el . on ( "mouseup" , function ( e ) {
434
435
-- c . _eventinfo . is_button_pressed ;
435
436
var event = gen_mouse_event ( c , e , 'mouse_release' ) ;
436
437
@@ -443,35 +444,35 @@ function init_app(c) {
443
444
// c._eventinfo.last_event = event;
444
445
c . event_queue . append ( event ) ;
445
446
} ) ;
446
- c . $el . click ( function ( e ) {
447
+ c . $el . on ( "click" , function ( e ) {
447
448
// Reset the last press event.
448
449
c . _eventinfo . press_event = null ;
449
450
} ) ;
450
- c . $el . dblclick ( function ( e ) {
451
+ c . $el . on ( "dblclick" , function ( e ) {
451
452
452
453
// Reset the last press event.
453
454
c . _eventinfo . press_event = null ;
454
455
} ) ;
455
456
// This requires the mouse wheel jquery plugin.
456
- if ( c . $el . mousewheel != undefined ) {
457
- c . $el . mousewheel ( function ( e ) {
458
- var event = gen_mouse_event ( c , e , 'mouse_wheel' ) ;
459
- event . delta = [ e . deltaX * e . deltaFactor * 0.01 ,
460
- e . deltaY * e . deltaFactor * 0.01 ] ;
461
-
462
- // Vispy callbacks.
463
- c . _mouse_wheel ( event ) ;
464
-
465
- // Save the last event.
466
- // c._eventinfo.last_event = event;
467
- c . event_queue . append ( event ) ;
468
-
469
- e . preventDefault ( ) ;
470
- e . stopPropagation ( ) ;
471
- } ) ;
472
- }
457
+ c . $el . on ( "wheel" , function ( e ) {
458
+ var event = gen_mouse_event ( c , e , 'mouse_wheel' ) ;
459
+ // event.delta = [e.originalEvent.deltaX * e.deltaFactor * 0.01,
460
+ // e.originalEvent.deltaY * e.deltaFactor * 0.01];
461
+ event . delta = [ e . originalEvent . deltaX * 0.01 ,
462
+ e . originalEvent . deltaY * 0.01 ] ;
463
+
464
+ // Vispy callbacks.
465
+ c . _mouse_wheel ( event ) ;
466
+
467
+ // Save the last event.
468
+ // c._eventinfo.last_event = event;
469
+ c . event_queue . append ( event ) ;
470
+
471
+ e . preventDefault ( ) ;
472
+ e . stopPropagation ( ) ;
473
+ } ) ;
473
474
474
- c . $el . keydown ( function ( e ) {
475
+ c . $el . on ( "keydown" , function ( e ) {
475
476
var event = gen_key_event ( c , e , 'key_press' ) ;
476
477
477
478
// Vispy callbacks.
@@ -481,7 +482,7 @@ function init_app(c) {
481
482
// c._eventinfo.last_event = event;
482
483
c . event_queue . append ( event ) ;
483
484
} ) ;
484
- c . $el . keyup ( function ( e ) {
485
+ c . $el . on ( "keyup" , function ( e ) {
485
486
var event = gen_key_event ( c , e , 'key_release' ) ;
486
487
487
488
// Vispy callbacks.
@@ -492,7 +493,7 @@ function init_app(c) {
492
493
c . event_queue . append ( event ) ;
493
494
} ) ;
494
495
495
- c . $el . mouseout ( function ( e ) {
496
+ c . $el . on ( "mouseout" , function ( e ) {
496
497
} ) ;
497
498
}
498
499
0 commit comments