@@ -1881,21 +1881,24 @@ export class Figure extends PlotData {
18811881 if ( ! ctrlKey ) { this . isSelecting = true ; canvas . style . cursor = 'crosshair' ; this . draw ( ) } ;
18821882 }
18831883 if ( e . key == " " ) {
1884+ e . preventDefault ( ) ;
18841885 spaceKey = true ;
18851886 if ( ctrlKey && this . isInCanvas ( absoluteMouse ) ) this . resetView ( ) ;
18861887 }
18871888 } ) ;
18881889
18891890 window . addEventListener ( 'keyup' , e => {
1891+ e . preventDefault ( ) ;
18901892 if ( e . key == "Control" ) ctrlKey = false ;
18911893 if ( e . key == " " ) spaceKey = false ;
18921894 if ( e . key == "Shift" ) { shiftKey = false ; this . isSelecting = false ; this . is_drawing_rubber_band = false ; canvas . style . cursor = 'default' ; this . draw ( ) } ;
18931895 } ) ;
18941896
18951897 canvas . addEventListener ( 'mousemove' , e => {
1898+ e . preventDefault ( ) ;
18961899 [ canvasMouse , frameMouse , absoluteMouse ] = this . projectMouse ( e ) ;
18971900 this . mouseMove ( canvasMouse , frameMouse , absoluteMouse ) ;
1898- if ( this . isZooming ) canvas . style . cursor = 'crosshair' ;
1901+ if ( this . isZooming || this . isSelecting ) canvas . style . cursor = 'crosshair' ;
18991902 if ( this . interaction_ON ) {
19001903 if ( isDrawing ) {
19011904 const translation = this . mouseTranslate ( canvasMouse , canvasDown ) ;
@@ -1914,14 +1917,14 @@ export class Figure extends PlotData {
19141917 if ( ! mouseInCanvas ) isDrawing = false ;
19151918 } ) ;
19161919
1917- canvas . addEventListener ( 'mousedown' , e => {
1920+ canvas . addEventListener ( 'mousedown' , ( ) => {
19181921 [ canvasDown , frameDown , clickedObject ] = this . mouseDown ( canvasMouse , frameMouse , absoluteMouse ) ;
19191922 if ( ! ( clickedObject instanceof newAxis ) ) this . is_drawing_rubber_band = this . isSelecting ;
19201923 if ( ctrlKey && shiftKey ) this . reset ( ) ;
19211924 isDrawing = true ;
19221925 } ) ;
19231926
1924- canvas . addEventListener ( 'mouseup' , e => {
1927+ canvas . addEventListener ( 'mouseup' , ( ) => {
19251928 if ( this . isZooming ) {
19261929 this . switchZoom ( ) ;
19271930 this . zoomBoxUpdateAxes ( zoomBox ) ;
@@ -1933,14 +1936,15 @@ export class Figure extends PlotData {
19331936 } )
19341937
19351938 canvas . addEventListener ( 'wheel' , e => {
1939+ e . preventDefault ( ) ;
19361940 if ( this . interaction_ON ) {
19371941 this . wheelFromEvent ( e ) ;
19381942 this . updateWithScale ( ) ;
19391943 this . draw ( ) ;
19401944 }
19411945 } ) ;
19421946
1943- canvas . addEventListener ( 'mouseleave' , e => {
1947+ canvas . addEventListener ( 'mouseleave' , ( ) => {
19441948 isDrawing = false ;
19451949 ctrlKey = false ;
19461950 this . axes . forEach ( axis => axis . saveLocation ( ) ) ;
0 commit comments