From 0e061034ad3100d8b41d96506533b97dbfdde960 Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Sat, 24 Jun 2023 21:14:10 -0400 Subject: [PATCH 1/8] fix(accidental): extra space in 2nds w/ stems down --- src/accidental.ts | 178 +++++++++++++++++++++++++++++++++------------- test.html | 64 +++++++++++++++++ 2 files changed, 192 insertions(+), 50 deletions(-) create mode 100644 test.html diff --git a/src/accidental.ts b/src/accidental.ts index b2286f55e7..a5b43f6798 100644 --- a/src/accidental.ts +++ b/src/accidental.ts @@ -15,10 +15,18 @@ import { Category, isAccidental, isGraceNote, isGraceNoteGroup, isStaveNote } fr import { defined, log } from './util'; import { Voice } from './voice'; -export type Line = { +type StaveLineAccidentalLayoutMetrics = { column: number; line: number; + /** + * A flat line needs more clearance above than below. This is + * set to true if the accidental is either a flat or double flat. + */ flatLine: boolean; + /** + * Double sharps need less clearance above and below than other + * accidentals. + */ dblSharpLine: boolean; numAcc: number; width: number; @@ -74,30 +82,63 @@ export class Accidental extends Modifier { const additionalPadding = musicFont.lookupMetric('accidental.leftPadding'); // padding to the left of all accidentals // A type used just in this formatting function. - type AccidentalListItem = { + type AccidentalLinePositionsAndXSpaceNeeds = { y?: number; line: number; - shift: number; + /** + * The amount by which the accidental requests notes be shifted to the right + * to accomodate its presence. + */ + extraXSpaceNeeded: number; acc: Accidental; - lineSpace?: number; + spacingBetweenStaveLines?: number; }; - const accList: AccidentalListItem[] = []; + const accidentalLinePositionsAndSpaceNeeds: AccidentalLinePositionsAndXSpaceNeeds[] = []; let prevNote = undefined; - let shiftL = 0; + let extraXSpaceNeededForLeftDisplacedNotehead = 0; // First determine the accidentals' Y positions from the note.keys for (let i = 0; i < accidentals.length; ++i) { const acc: Accidental = accidentals[i]; const note = acc.getNote(); + const stemDirection = note.getStemDirection(); const stave = note.getStave(); const index = acc.checkIndex(); const props = note.getKeyProps()[index]; + + let headDisplacementXShift = 0; if (note !== prevNote) { // Iterate through all notes to get the displaced pixels for (let n = 0; n < note.keys.length; ++n) { - shiftL = Math.max(note.getLeftDisplacedHeadPx() - note.getXShift(), shiftL); + const priorShiftL = extraXSpaceNeededForLeftDisplacedNotehead; + // The extra space we need for the accidental to the left is the amount + // that the left-displaced notehead has been shifted left, less any + // extra space that has already been added via the note's xShift. + const leftDisplacedNoteheadShift = note.getLeftDisplacedHeadPx() - note.getXShift(); + // If the current extra left-space needed (shiftL) isn't as big as that, + // then we need to set it. But, this will give the accidental ownership of + // that x-space, and later when formatting the note, its x_begin would have + // twice the getLeftDisplacedHeadPx included in it. So: we need to remove + // it from the note's x shift. + // if (leftDisplacedNoteheadShift > extraXSpaceNeededForLeftDisplacedNotehead) { + // extraXSpaceNeededForLeftDisplacedNotehead = leftDisplacedNoteheadShift; + // note.setLeftDisplacedHeadPx(-note.getXShift()); + // } + extraXSpaceNeededForLeftDisplacedNotehead = Math.max( + note.getLeftDisplacedHeadPx() - note.getXShift(), + extraXSpaceNeededForLeftDisplacedNotehead + ); + headDisplacementXShift = note.getLeftDisplacedHeadPx(); + + // console.log({ + // getLeftDisplacedHeadPx: note.getLeftDisplacedHeadPx(), + // getXShift: note.getXShift(), + // getLeftDisplacedHeadPx_minus_getXShift: note.getLeftDisplacedHeadPx() - note.getXShift(), + // shiftL: extraXSpaceNeededForLeftDisplacedNotehead, + // priorShiftL, + // }); } prevNote = note; } @@ -105,64 +146,83 @@ export class Accidental extends Modifier { const lineSpace = stave.getSpacingBetweenLines(); const y = stave.getYForLine(props.line); const accLine = Math.round((y / lineSpace) * 2) / 2; - accList.push({ y, line: accLine, shift: shiftL, acc, lineSpace }); + accidentalLinePositionsAndSpaceNeeds.push({ + y, + line: accLine, + extraXSpaceNeeded: extraXSpaceNeededForLeftDisplacedNotehead, + acc, + spacingBetweenStaveLines: lineSpace, + }); } else { - accList.push({ line: props.line, shift: shiftL, acc }); + accidentalLinePositionsAndSpaceNeeds.push({ + line: props.line, + extraXSpaceNeeded: extraXSpaceNeededForLeftDisplacedNotehead, + acc, + }); } } // Sort accidentals by line number. - accList.sort((a, b) => b.line - a.line); + accidentalLinePositionsAndSpaceNeeds.sort((a, b) => b.line - a.line); // FIXME: Confusing name. Each object in this array has a property called `line`. // So if this is a list of lines, you end up with: `line.line` which is very awkward. - const lineList: Line[] = []; + const staveLineAccidentalLayoutMetrics: StaveLineAccidentalLayoutMetrics[] = []; // amount by which all accidentals must be shifted right or left for // stem flipping, notehead shifting concerns. - let accShift = 0; - let previousLine = undefined; + let maxExtraXSpaceNeeded = 0; - // Create an array of unique line numbers (lineList) from accList - for (let i = 0; i < accList.length; i++) { - const acc = accList[i]; + // Create an array of unique line numbers (staveLineAccidentalLayoutMetrics) + // from accidentalLinePositionsAndSpaceNeeds + for (let i = 0; i < accidentalLinePositionsAndSpaceNeeds.length; i++) { + const accidentalLinePositionAndSpaceNeeds = accidentalLinePositionsAndSpaceNeeds[i]; - // if this is the first line, or a new line, add a lineList - if (previousLine === undefined || previousLine !== acc.line) { - lineList.push({ - line: acc.line, + const priorLineMetric = staveLineAccidentalLayoutMetrics[staveLineAccidentalLayoutMetrics.length - 1]; + let currentLineMetric: StaveLineAccidentalLayoutMetrics; + + // if this is the first line, or a new line, add a staveLineAccidentalLayoutMetric + if (!priorLineMetric || priorLineMetric?.line !== accidentalLinePositionAndSpaceNeeds.line) { + currentLineMetric = { + line: accidentalLinePositionAndSpaceNeeds.line, flatLine: true, dblSharpLine: true, numAcc: 0, width: 0, column: 0, - }); + }; + staveLineAccidentalLayoutMetrics.push(currentLineMetric); + } else { + currentLineMetric = priorLineMetric; } + // if this accidental is not a flat, the accidental needs 3.0 lines lower // clearance instead of 2.5 lines for b or bb. // FIXME: Naming could use work. acc.acc is very awkward - if (acc.acc.type !== 'b' && acc.acc.type !== 'bb') { - lineList[lineList.length - 1].flatLine = false; + if ( + accidentalLinePositionAndSpaceNeeds.acc.type !== 'b' && + accidentalLinePositionAndSpaceNeeds.acc.type !== 'bb' + ) { + currentLineMetric.flatLine = false; } // if this accidental is not a double sharp, the accidental needs 3.0 lines above - if (acc.acc.type !== '##') { - lineList[lineList.length - 1].dblSharpLine = false; + if (accidentalLinePositionAndSpaceNeeds.acc.type !== '##') { + currentLineMetric.dblSharpLine = false; } // Track how many accidentals are on this line: - lineList[lineList.length - 1].numAcc++; + currentLineMetric.numAcc++; // Track the total x_offset needed for this line which will be needed // for formatting lines w/ multiple accidentals: // width = accidental width + universal spacing between accidentals - lineList[lineList.length - 1].width += acc.acc.getWidth() + accidentalSpacing; - - // if this accShift is larger, use it to keep first column accidentals in the same line - accShift = acc.shift > accShift ? acc.shift : accShift; + currentLineMetric.width += accidentalLinePositionAndSpaceNeeds.acc.getWidth() + accidentalSpacing; - previousLine = acc.line; + // if this extraXSpaceNeeded is the largest so far, use it as the starting point for + // all accidental columns. + maxExtraXSpaceNeeded = Math.max(accidentalLinePositionAndSpaceNeeds.extraXSpaceNeeded, maxExtraXSpaceNeeded); } // ### Place Accidentals in Columns @@ -186,14 +246,19 @@ export class Accidental extends Modifier { let totalColumns = 0; // establish the boundaries for a group of notes with clashing accidentals: - for (let i = 0; i < lineList.length; i++) { + for (let i = 0; i < staveLineAccidentalLayoutMetrics.length; i++) { let noFurtherConflicts = false; const groupStart = i; let groupEnd = i; - while (groupEnd + 1 < lineList.length && !noFurtherConflicts) { + while (groupEnd + 1 < staveLineAccidentalLayoutMetrics.length && !noFurtherConflicts) { // if this note conflicts with the next: - if (this.checkCollision(lineList[groupEnd], lineList[groupEnd + 1])) { + if ( + this.checkCollision( + staveLineAccidentalLayoutMetrics[groupEnd], + staveLineAccidentalLayoutMetrics[groupEnd + 1] + ) + ) { // include the next note in the group: groupEnd++; } else { @@ -202,7 +267,7 @@ export class Accidental extends Modifier { } // Gets an a line from the `lineList`, relative to the current group - const getGroupLine = (index: number) => lineList[groupStart + index]; + const getGroupLine = (index: number) => staveLineAccidentalLayoutMetrics[groupStart + index]; const getGroupLines = (indexes: number[]) => indexes.map(getGroupLine); const lineDifference = (indexA: number, indexB: number) => { const [a, b] = getGroupLines([indexA, indexB]).map((item) => item.line); @@ -216,7 +281,12 @@ export class Accidental extends Modifier { const groupLength = groupEnd - groupStart + 1; // Set the accidental column for each line of the group - let endCase = this.checkCollision(lineList[groupStart], lineList[groupEnd]) ? 'a' : 'b'; + let endCase = this.checkCollision( + staveLineAccidentalLayoutMetrics[groupStart], + staveLineAccidentalLayoutMetrics[groupEnd] + ) + ? 'a' + : 'b'; switch (groupLength) { case 3: @@ -259,8 +329,13 @@ export class Accidental extends Modifier { let collisionDetected = true; while (collisionDetected === true) { collisionDetected = false; - for (let line = 0; line + patternLength < lineList.length; line++) { - if (this.checkCollision(lineList[line], lineList[line + patternLength])) { + for (let line = 0; line + patternLength < staveLineAccidentalLayoutMetrics.length; line++) { + if ( + this.checkCollision( + staveLineAccidentalLayoutMetrics[line], + staveLineAccidentalLayoutMetrics[line + patternLength] + ) + ) { collisionDetected = true; patternLength++; break; @@ -270,7 +345,7 @@ export class Accidental extends Modifier { // Then, assign a column to each line of accidentals for (groupMember = i; groupMember <= groupEnd; groupMember++) { column = ((groupMember - i) % patternLength) + 1; - lineList[groupMember].column = column; + staveLineAccidentalLayoutMetrics[groupMember].column = column; totalColumns = totalColumns > column ? totalColumns : column; } } else { @@ -278,7 +353,7 @@ export class Accidental extends Modifier { // the Tables.accidentalColumnsTable (See: tables.ts). for (groupMember = i; groupMember <= groupEnd; groupMember++) { column = Tables.accidentalColumnsTable[groupLength][endCase][groupMember - i]; - lineList[groupMember].column = column; + staveLineAccidentalLayoutMetrics[groupMember].column = column; totalColumns = totalColumns > column ? totalColumns : column; } } @@ -308,12 +383,14 @@ export class Accidental extends Modifier { columnXOffsets[i] = 0; } - columnWidths[0] = accShift + leftShift; - columnXOffsets[0] = accShift + leftShift; + // columnWidths[0] = maxExtraXSpaceNeeded + leftShift; + // columnXOffsets[0] = maxExtraXSpaceNeeded + leftShift; + columnWidths[0] = leftShift + maxExtraXSpaceNeeded; + columnXOffsets[0] = leftShift; // Fill columnWidths with widest needed x-space; // this is what keeps the columns parallel. - lineList.forEach((line) => { + staveLineAccidentalLayoutMetrics.forEach((line) => { if (line.width > columnWidths[line.column]) columnWidths[line.column] = line.width; }); @@ -325,26 +402,27 @@ export class Accidental extends Modifier { const totalShift = columnXOffsets[columnXOffsets.length - 1]; // Set the xShift for each accidental according to column offsets: let accCount = 0; - lineList.forEach((line) => { + staveLineAccidentalLayoutMetrics.forEach((line) => { let lineWidth = 0; const lastAccOnLine = accCount + line.numAcc; // handle all of the accidentals on a given line: for (accCount; accCount < lastAccOnLine; accCount++) { - const xShift = columnXOffsets[line.column - 1] + lineWidth; - accList[accCount].acc.setXShift(xShift); + const xShift = columnXOffsets[line.column - 1] + lineWidth + maxExtraXSpaceNeeded; + accidentalLinePositionsAndSpaceNeeds[accCount].acc.setXShift(xShift); // keep track of the width of accidentals we've added so far, so that when // we loop, we add space for them. - lineWidth += accList[accCount].acc.getWidth() + accidentalSpacing; + lineWidth += accidentalLinePositionsAndSpaceNeeds[accCount].acc.getWidth() + accidentalSpacing; + // console.log('Line, accCount, shift: ', line.line, accCount, xShift); L('Line, accCount, shift: ', line.line, accCount, xShift); } }); - + // console.log({ totalShift, columnXOffsets, additionalPadding }); // update the overall layout with the full width of the accidental shapes: - state.left_shift += totalShift + additionalPadding; + state.left_shift = totalShift + additionalPadding; } /** Helper function to determine whether two lines of accidentals collide vertically */ - static checkCollision(line1: Line, line2: Line): boolean { + static checkCollision(line1: StaveLineAccidentalLayoutMetrics, line2: StaveLineAccidentalLayoutMetrics): boolean { let clearance = line2.line - line1.line; let clearanceRequired = 3; // But less clearance is required for certain accidentals: b, bb and ##. diff --git a/test.html b/test.html new file mode 100644 index 0000000000..3b1860382b --- /dev/null +++ b/test.html @@ -0,0 +1,64 @@ + + + + + +
+
+ + + + From 7fa3ce0ef79700f9eb2f24905451e3a55ddaf96e Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Sun, 25 Jun 2023 00:10:50 -0400 Subject: [PATCH 2/8] chore(accidental): Remove console.log --- src/accidental.ts | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/accidental.ts b/src/accidental.ts index a5b43f6798..a118e213df 100644 --- a/src/accidental.ts +++ b/src/accidental.ts @@ -108,37 +108,15 @@ export class Accidental extends Modifier { const index = acc.checkIndex(); const props = note.getKeyProps()[index]; - let headDisplacementXShift = 0; if (note !== prevNote) { // Iterate through all notes to get the displaced pixels for (let n = 0; n < note.keys.length; ++n) { - const priorShiftL = extraXSpaceNeededForLeftDisplacedNotehead; - // The extra space we need for the accidental to the left is the amount - // that the left-displaced notehead has been shifted left, less any - // extra space that has already been added via the note's xShift. - const leftDisplacedNoteheadShift = note.getLeftDisplacedHeadPx() - note.getXShift(); - // If the current extra left-space needed (shiftL) isn't as big as that, - // then we need to set it. But, this will give the accidental ownership of - // that x-space, and later when formatting the note, its x_begin would have - // twice the getLeftDisplacedHeadPx included in it. So: we need to remove - // it from the note's x shift. - // if (leftDisplacedNoteheadShift > extraXSpaceNeededForLeftDisplacedNotehead) { - // extraXSpaceNeededForLeftDisplacedNotehead = leftDisplacedNoteheadShift; - // note.setLeftDisplacedHeadPx(-note.getXShift()); - // } + // If the current extra left-space needed isn't as big as this note's, + // then we need to use this note's. extraXSpaceNeededForLeftDisplacedNotehead = Math.max( note.getLeftDisplacedHeadPx() - note.getXShift(), extraXSpaceNeededForLeftDisplacedNotehead ); - headDisplacementXShift = note.getLeftDisplacedHeadPx(); - - // console.log({ - // getLeftDisplacedHeadPx: note.getLeftDisplacedHeadPx(), - // getXShift: note.getXShift(), - // getLeftDisplacedHeadPx_minus_getXShift: note.getLeftDisplacedHeadPx() - note.getXShift(), - // shiftL: extraXSpaceNeededForLeftDisplacedNotehead, - // priorShiftL, - // }); } prevNote = note; } @@ -412,11 +390,9 @@ export class Accidental extends Modifier { // keep track of the width of accidentals we've added so far, so that when // we loop, we add space for them. lineWidth += accidentalLinePositionsAndSpaceNeeds[accCount].acc.getWidth() + accidentalSpacing; - // console.log('Line, accCount, shift: ', line.line, accCount, xShift); L('Line, accCount, shift: ', line.line, accCount, xShift); } }); - // console.log({ totalShift, columnXOffsets, additionalPadding }); // update the overall layout with the full width of the accidental shapes: state.left_shift = totalShift + additionalPadding; } From a4342fd50ea7d8eab13ea294c59d85a15244b1b5 Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Sun, 25 Jun 2023 00:12:00 -0400 Subject: [PATCH 3/8] fix(stringnumber): avoid crashes with other left modifiers --- src/stringnumber.ts | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/stringnumber.ts b/src/stringnumber.ts index 0103b76c81..14e4aefda9 100644 --- a/src/stringnumber.ts +++ b/src/stringnumber.ts @@ -48,7 +48,13 @@ export class StringNumber extends Modifier { // ## Static Methods // Arrange string numbers inside a `ModifierContext` static format(nums: StringNumber[], state: ModifierContextState): boolean { + /** + * The modifier context's left_shift state. + */ const left_shift = state.left_shift; + /** + * The modifier context's right_shift state. + */ const right_shift = state.right_shift; const num_spacing = 1; @@ -56,7 +62,7 @@ export class StringNumber extends Modifier { const nums_list = []; let prev_note = null; - let shift_left = 0; + let extraXSpaceForDisplacedNotehead = 0; let shift_right = 0; const modLines = 0; @@ -84,8 +90,8 @@ export class StringNumber extends Modifier { if (note !== prev_note) { for (let n = 0; n < note.keys.length; ++n) { - if (left_shift === 0) { - shift_left = Math.max(note.getLeftDisplacedHeadPx(), shift_left); + if (pos === Modifier.Position.LEFT) { + extraXSpaceForDisplacedNotehead = Math.max(note.getLeftDisplacedHeadPx(), extraXSpaceForDisplacedNotehead); } if (right_shift === 0) { shift_right = Math.max(note.getRightDisplacedHeadPx(), shift_right); @@ -101,7 +107,7 @@ export class StringNumber extends Modifier { note, num, line: glyphLine, - shiftL: shift_left, + shiftL: extraXSpaceForDisplacedNotehead, shiftR: shift_right, }); } @@ -115,7 +121,6 @@ export class StringNumber extends Modifier { let last_line = null; let last_note = null; for (let i = 0; i < nums_list.length; ++i) { - let num_shift = 0; const note = nums_list[i].note; const pos = nums_list[i].pos; const num = nums_list[i].num; @@ -127,14 +132,15 @@ export class StringNumber extends Modifier { } const num_width = num.getWidth() + num_spacing; + let num_x_shift = 0; if (pos === Modifier.Position.LEFT) { - num.setXShift(left_shift); - num_shift = shift_left + num_width; // spacing - x_widthL = num_shift > x_widthL ? num_shift : x_widthL; + num.setXShift(left_shift + extraXSpaceForDisplacedNotehead); + num_x_shift = num_width; // spacing + x_widthL = Math.max(num_x_shift, x_widthL); } else if (pos === Modifier.Position.RIGHT) { num.setXShift(num_shiftR); - num_shift += num_width; // spacing - x_widthR = num_shift > x_widthR ? num_shift : x_widthR; + num_x_shift += num_width; // spacing + x_widthR = num_x_shift > x_widthR ? num_x_shift : x_widthR; } last_line = line; last_note = note; From f613cb8292778475015235a3f3b40a83f98d5adc Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Sun, 25 Jun 2023 00:13:12 -0400 Subject: [PATCH 4/8] chore: Remove wip testing file --- test.html | 64 ------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 test.html diff --git a/test.html b/test.html deleted file mode 100644 index 3b1860382b..0000000000 --- a/test.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -
-
- - - - From d7ebc5f164756b38685c9776a64c2af7eeaf3d10 Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Sun, 25 Jun 2023 00:58:30 -0400 Subject: [PATCH 5/8] test(stringnumber): Add test for displaced noteheads/multiple modifiers --- tests/stringnumber_tests.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/stringnumber_tests.ts b/tests/stringnumber_tests.ts index 34acd299b1..84bab434e2 100644 --- a/tests/stringnumber_tests.ts +++ b/tests/stringnumber_tests.ts @@ -21,6 +21,7 @@ const StringNumberTests = { run('Fret Hand Finger In Notation', drawFretHandFingers); run('Multi Voice With Strokes, String & Finger Numbers', multi); run('Complex Measure With String & Finger Numbers', drawAccidentals); + run('Shifted Notehead, Multiple Modifiers', shiftedNoteheadMultipleModifiers); }, }; @@ -349,5 +350,29 @@ function drawAccidentals(options: TestOptions): void { options.assert.ok(true, 'String Number'); } +function shiftedNoteheadMultipleModifiers(options: TestOptions): void { + const f = VexFlowTests.makeFactory(options, 900, 150); + const score = f.EasyScore(); + score.set({ time: '6/4' }); + + const stave = f.Stave({ width: 900 }).setEndBarType(BarlineType.END).addClef('treble'); + + const notes = ['A4 B4', 'B4 C5', 'A4 B#4', 'B4 C#5', 'A#4 B#4', 'B#4 C#5'] + .map((keys) => score.notes(`(${keys})/q`)) + .flat(); + notes.forEach((note) => { + note + .addModifier(f.StringNumber({ number: '2', position: 'left' }, true), 1) + .addModifier(f.StringNumber({ number: '2', position: 'right' }, true), 1); + }); + + const voice = score.voice(notes); + + f.Formatter().joinVoices([voice]).formatToStave([voice], stave); + + f.draw(); + + options.assert.ok(true, 'String Number'); +} VexFlowTests.register(StringNumberTests); export { StringNumberTests }; From 9708ab8dddffd35842780111685d793a74211fe4 Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Sun, 25 Jun 2023 11:13:42 -0400 Subject: [PATCH 6/8] chore(accidentals): Remove FIXME label for things that are fixed. --- src/accidental.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/accidental.ts b/src/accidental.ts index a118e213df..4cc535df5d 100644 --- a/src/accidental.ts +++ b/src/accidental.ts @@ -143,8 +143,6 @@ export class Accidental extends Modifier { // Sort accidentals by line number. accidentalLinePositionsAndSpaceNeeds.sort((a, b) => b.line - a.line); - // FIXME: Confusing name. Each object in this array has a property called `line`. - // So if this is a list of lines, you end up with: `line.line` which is very awkward. const staveLineAccidentalLayoutMetrics: StaveLineAccidentalLayoutMetrics[] = []; // amount by which all accidentals must be shifted right or left for @@ -176,7 +174,6 @@ export class Accidental extends Modifier { // if this accidental is not a flat, the accidental needs 3.0 lines lower // clearance instead of 2.5 lines for b or bb. - // FIXME: Naming could use work. acc.acc is very awkward if ( accidentalLinePositionAndSpaceNeeds.acc.type !== 'b' && accidentalLinePositionAndSpaceNeeds.acc.type !== 'bb' From afb2529466e86e23b076bad044bf39189303d86d Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Mon, 26 Jun 2023 16:42:58 -0400 Subject: [PATCH 7/8] chore(accidental): Remove unused, commented-out code --- src/accidental.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/accidental.ts b/src/accidental.ts index 4cc535df5d..050e09c313 100644 --- a/src/accidental.ts +++ b/src/accidental.ts @@ -358,8 +358,6 @@ export class Accidental extends Modifier { columnXOffsets[i] = 0; } - // columnWidths[0] = maxExtraXSpaceNeeded + leftShift; - // columnXOffsets[0] = maxExtraXSpaceNeeded + leftShift; columnWidths[0] = leftShift + maxExtraXSpaceNeeded; columnXOffsets[0] = leftShift; From c32f936a0b2392104bdf3e5b1404a61a83d9ee04 Mon Sep 17 00:00:00 2001 From: Greg Ristow Date: Fri, 30 Jun 2023 09:09:07 -0400 Subject: [PATCH 8/8] chore(accidental): Remove unused variable --- src/accidental.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/accidental.ts b/src/accidental.ts index 050e09c313..49bcbdcbb2 100644 --- a/src/accidental.ts +++ b/src/accidental.ts @@ -103,7 +103,6 @@ export class Accidental extends Modifier { const acc: Accidental = accidentals[i]; const note = acc.getNote(); - const stemDirection = note.getStemDirection(); const stave = note.getStave(); const index = acc.checkIndex(); const props = note.getKeyProps()[index];