@@ -1755,26 +1755,17 @@ class Activity {
17551755 * Sets up block actions with regards to different mouse events
17561756 */
17571757 this . _setupBlocksContainerEvents = ( ) => {
1758- const moving = false ;
1759- let lastCoords = {
1760- x : 0 ,
1761- y : 0 ,
1762- delta : 0
1763- } ;
1764-
17651758 const that = this ;
1759+ let lastCoords = { x : 0 , y : 0 , delta : 0 } ;
17661760
17671761 /**
17681762 * Closes any open menus and labels.
17691763 */
17701764 const closeAnyOpenMenusAndLabels = ( ) => {
1771- if ( docById ( "wheelDiv" ) !== null ) docById ( "wheelDiv" ) . style . display = "none" ;
1772- if ( docById ( "contextWheelDiv" ) !== null )
1773- docById ( "contextWheelDiv" ) . style . display = "none" ;
1774- if ( docById ( "helpfulWheelDiv" ) !== null )
1775- docById ( "helpfulWheelDiv" ) . style . display = "none" ;
1776- if ( docById ( "textLabel" ) !== null ) docById ( "textLabel" ) . style . display = "none" ;
1777- if ( docById ( "numberLabel" ) !== null ) docById ( "numberLabel" ) . style . display = "none" ;
1765+ [ 'wheelDiv' , 'contextWheelDiv' , 'helpfulWheelDiv' , 'textLabel' , 'numberLabel' ] . forEach ( id => {
1766+ const elem = docById ( id ) ;
1767+ if ( elem ) elem . style . display = 'none' ;
1768+ } ) ;
17781769 } ;
17791770
17801771 /**
@@ -1898,30 +1889,23 @@ class Activity {
18981889 * @param {WheelEvent } event - The wheel event object.
18991890 */
19001891 const __wheelHandler = ( event ) => {
1901- const data = normalizeWheel ( event ) ; // normalize over different browsers
1892+ const data = normalizeWheel ( event ) ;
19021893 const delY = data . pixelY ;
19031894 const delX = data . pixelX ;
1904-
1905- //Ctrl+MouseWheel Zoom functionality
1895+
19061896 if ( event . ctrlKey ) {
1907- event . preventDefault ( ) ; // Prevent default scrolling behavior
1908-
1909- if ( delY < 0 && doLargerBlocks ( this ) ) ; //Zoom IN
1910- if ( delY >= 0 && doSmallerBlocks ( this ) ) ; //Zoom Out
1911- }
1912- if ( delY !== 0 && event . axis === event . VERTICAL_AXIS ) {
1913- closeAnyOpenMenusAndLabels ( ) ; // closes all wheelnavs when scrolling .
1897+ event . preventDefault ( ) ;
1898+ delY < 0 ? doLargerBlocks ( that ) : doSmallerBlocks ( that ) ;
1899+ } else if ( delY !== 0 && event . axis === event . VERTICAL_AXIS ) {
1900+ closeAnyOpenMenusAndLabels ( ) ;
19141901 that . blocksContainer . y -= delY ;
1915- }
1916- // horizontal scroll
1917- if ( that . scrollBlockContainer ) {
1918- if ( delX !== 0 && event . axis === event . HORIZONTAL_AXIS ) {
1919- closeAnyOpenMenusAndLabels ( ) ;
1920- that . blocksContainer . x -= delX ;
1921- }
1902+ } else if ( that . scrollBlockContainer && delX !== 0 && event . axis === event . HORIZONTAL_AXIS ) {
1903+ closeAnyOpenMenusAndLabels ( ) ;
1904+ that . blocksContainer . x -= delX ;
19221905 } else {
19231906 event . preventDefault ( ) ;
19241907 }
1908+
19251909 that . refreshCanvas ( ) ;
19261910 } ;
19271911
@@ -1973,12 +1957,10 @@ class Activity {
19731957
19741958 that . stage . removeAllEventListeners ( "stagemousemove" ) ;
19751959 that . stage . on ( "stagemousemove" , ( event ) => {
1976- that . stageX = event . stageX ;
1977- that . stageY = event . stageY ;
1978-
1979- if ( ! moving ) {
1980- return ;
1981- }
1960+ that . stageX = moveEvent . stageX ;
1961+ that . stageY = moveEvent . stageY ;
1962+
1963+ if ( ! that . moving ) return ;
19821964
19831965 // if we are moving the block container, deselect the active block.
19841966 // Deselect active block if moving the block container
@@ -4182,7 +4164,7 @@ class Activity {
41824164 let st = sched [ j ] . start ;
41834165 let ed = sched [ j ] . end ;
41844166 let dur = ed - st ;
4185- var temp = this . getClosestStandardNoteValue ( dur * 3 / 8 ) ;
4167+ let temp = this . getClosestStandardNoteValue ( dur * 3 / 8 ) ;
41864168 shortestNoteDenominator = Math . max ( shortestNoteDenominator , temp [ 1 ] ) ;
41874169 }
41884170
@@ -4224,7 +4206,7 @@ class Activity {
42244206 }
42254207 return ar ;
42264208 } ;
4227- var obj = this . getClosestStandardNoteValue ( duration * 3 / 8 ) ;
4209+ let obj = this . getClosestStandardNoteValue ( duration * 3 / 8 ) ;
42284210 // let scalingFactor=1;
42294211 // if(shortestNoteDenominator>32)
42304212 // scalingFactor=shortestNoteDenominator/32;
0 commit comments