@@ -1756,25 +1756,17 @@ class Activity {
17561756 */
17571757 this . _setupBlocksContainerEvents = ( ) => {
17581758 const moving = false ;
1759- let lastCoords = {
1760- x : 0 ,
1761- y : 0 ,
1762- delta : 0
1763- } ;
1764-
17651759 const that = this ;
1760+ let lastCoords = { x : 0 , y : 0 , delta : 0 } ;
17661761
17671762 /**
17681763 * Closes any open menus and labels.
17691764 */
17701765 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" ;
1766+ [ 'wheelDiv' , 'contextWheelDiv' , 'helpfulWheelDiv' , 'textLabel' , 'numberLabel' ] . forEach ( id => {
1767+ const elem = docById ( id ) ;
1768+ if ( elem ) elem . style . display = 'none' ;
1769+ } ) ;
17781770 } ;
17791771
17801772 /**
@@ -1898,30 +1890,23 @@ class Activity {
18981890 * @param {WheelEvent } event - The wheel event object.
18991891 */
19001892 const __wheelHandler = ( event ) => {
1901- const data = normalizeWheel ( event ) ; // normalize over different browsers
1893+ const data = normalizeWheel ( event ) ;
19021894 const delY = data . pixelY ;
19031895 const delX = data . pixelX ;
1904-
1905- //Ctrl+MouseWheel Zoom functionality
1896+
19061897 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 .
1898+ event . preventDefault ( ) ;
1899+ delY < 0 ? doLargerBlocks ( that ) : doSmallerBlocks ( that ) ;
1900+ } else if ( delY !== 0 && event . axis === event . VERTICAL_AXIS ) {
1901+ closeAnyOpenMenusAndLabels ( ) ;
19141902 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- }
1903+ } else if ( that . scrollBlockContainer && delX !== 0 && event . axis === event . HORIZONTAL_AXIS ) {
1904+ closeAnyOpenMenusAndLabels ( ) ;
1905+ that . blocksContainer . x -= delX ;
19221906 } else {
19231907 event . preventDefault ( ) ;
19241908 }
1909+
19251910 that . refreshCanvas ( ) ;
19261911 } ;
19271912
@@ -1973,12 +1958,10 @@ class Activity {
19731958
19741959 that . stage . removeAllEventListeners ( "stagemousemove" ) ;
19751960 that . stage . on ( "stagemousemove" , ( event ) => {
1976- that . stageX = event . stageX ;
1977- that . stageY = event . stageY ;
1978-
1979- if ( ! moving ) {
1980- return ;
1981- }
1961+ that . stageX = moveEvent . stageX ;
1962+ that . stageY = moveEvent . stageY ;
1963+
1964+ if ( ! that . moving ) return ;
19821965
19831966 // if we are moving the block container, deselect the active block.
19841967 // Deselect active block if moving the block container
@@ -4182,7 +4165,7 @@ class Activity {
41824165 let st = sched [ j ] . start ;
41834166 let ed = sched [ j ] . end ;
41844167 let dur = ed - st ;
4185- var temp = this . getClosestStandardNoteValue ( dur * 3 / 8 ) ;
4168+ let temp = this . getClosestStandardNoteValue ( dur * 3 / 8 ) ;
41864169 shortestNoteDenominator = Math . max ( shortestNoteDenominator , temp [ 1 ] ) ;
41874170 }
41884171
@@ -4224,7 +4207,7 @@ class Activity {
42244207 }
42254208 return ar ;
42264209 } ;
4227- var obj = this . getClosestStandardNoteValue ( duration * 3 / 8 ) ;
4210+ let obj = this . getClosestStandardNoteValue ( duration * 3 / 8 ) ;
42284211 // let scalingFactor=1;
42294212 // if(shortestNoteDenominator>32)
42304213 // scalingFactor=shortestNoteDenominator/32;
0 commit comments