File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# majiccode.github.io
2+
3+ Toy website with just some experiments, doodles if you will..
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ if (canvas) {
155155 function getCanvasPosition ( e ) {
156156 const rect = canvas . getBoundingClientRect ( ) ;
157157 const x = e . clientX - rect . left + canvas . parentElement . scrollLeft ;
158- const y = e . clientY - rect . top ;
158+ const y = e . clientY - rect . top + canvas . parentElement . scrollTop ;
159159 return { x, y } ;
160160 }
161161
@@ -167,7 +167,7 @@ if (canvas) {
167167 const adjustedX = x - NOTE_LABEL_WIDTH ;
168168
169169 // Support quarter note resolution (0.25 beats) for syncopation
170- const beatPos = Math . round ( ( adjustedX / GRID_WIDTH ) * 4 ) / 4 ;
170+ const beatPos = Math . floor ( ( adjustedX / GRID_WIDTH ) * 4 ) / 4 ;
171171 const noteIndex = Math . floor ( y / NOTE_HEIGHT ) ;
172172
173173 const key = `${ noteIndex } -${ beatPos } ` ;
You can’t perform that action at this time.
0 commit comments