Skip to content

Commit

Permalink
remove drawVetical from Stave
Browse files Browse the repository at this point in the history
  • Loading branch information
rvilarl committed Oct 1, 2021
1 parent 961f26a commit eeeaf41
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 78 deletions.
32 changes: 0 additions & 32 deletions src/stave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,38 +773,6 @@ export class Stave extends Element {
return this;
}

// Draw Simple barlines for backward compatability
// Do not delete - draws the beginning bar of the stave
drawVertical(x: number, isDouble?: boolean): void {
this.drawVerticalFixed(this.x + x, isDouble);
}

drawVerticalFixed(x: number, isDouble?: boolean): void {
const ctx = this.checkContext();

const top_line = this.getYForLine(0);
const bottom_line = this.getYForLine(this.options.num_lines - 1);
if (isDouble) {
ctx.fillRect(x - 3, top_line, 1, bottom_line - top_line + 1);
}
ctx.fillRect(x, top_line, 1, bottom_line - top_line + 1);
}

drawVerticalBar(x: number, isDouble?: boolean): void {
this.drawVerticalBarFixed(this.x + x, isDouble);
}

drawVerticalBarFixed(x: number, isDouble?: boolean): void {
const ctx = this.checkContext();

const top_line = this.getYForLine(0);
const bottom_line = this.getYForLine(this.options.num_lines - 1);
if (isDouble) {
ctx.fillRect(x - 3, top_line, 1, bottom_line - top_line + 1);
}
ctx.fillRect(x, top_line, 1, bottom_line - top_line + 1);
}

getVerticalBarWidth(): number {
return this.options.vertical_bar_width;
}
Expand Down
14 changes: 0 additions & 14 deletions tests/stave_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const StaveTests = {
const run = VexFlowTests.runTests;
run('Stave Draw Test', draw);
run('Open Stave Draw Test', drawOpenStave);
run('Vertical Bar Test', drawVerticalBar);
run('Multiple Stave Barline Test', drawMultipleMeasures);
run('Multiple Stave Repeats Test', drawRepeats);
run('Stave End Modifiers Test', drawEndModifiers);
Expand Down Expand Up @@ -137,19 +136,6 @@ function drawOpenStave(options: TestOptions, contextBuilder: ContextBuilder): vo
ok(true, 'all pass');
}

function drawVerticalBar(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);
const stave = new Stave(10, 10, 300);
stave.setContext(ctx);
stave.draw();
stave.drawVerticalBar(50, true);
stave.drawVerticalBar(150, false);
stave.drawVertical(250, true);
stave.drawVertical(300);

ok(true, 'all pass');
}

function drawMultipleMeasures(options: TestOptions, contextBuilder: ContextBuilder): void {
expect(0);

Expand Down
17 changes: 0 additions & 17 deletions tests/stavemodifier_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const StaveModifierTests = {
QUnit.module('StaveModifier');
const run = VexFlowTests.runTests;
run('Stave Draw Test', draw);
run('Vertical Bar Test', drawVerticalBar);
run('Begin & End StaveModifier Test', drawBeginAndEnd);
},
};
Expand All @@ -33,22 +32,6 @@ function draw(options: TestOptions, contextBuilder: ContextBuilder): void {
ok(true, 'all pass');
}

/**
* Draw three vertical lines. The last line is not visible, because it overlaps
* the right border of the stave at x = 300.
*/
function drawVerticalBar(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);
const stave = new Stave(10, 10, 300);
stave.setContext(ctx);
stave.draw();
stave.drawVerticalBar(100);
stave.drawVerticalBar(150);
stave.drawVerticalBar(300);

ok(true, 'all pass');
}

function drawBeginAndEnd(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 500, 240);
const stave = new Stave(10, 10, 400);
Expand Down
15 changes: 0 additions & 15 deletions tests/tabstave_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const TabStaveTests = {
QUnit.module('TabStave');
const run = VexFlowTests.runTests;
run('TabStave Draw Test', draw);
run('Vertical Bar Test', drawVerticalBar);
},
};

Expand All @@ -32,18 +31,4 @@ function draw(options: TestOptions, contextBuilder: ContextBuilder): void {
ok(true, 'all pass');
}

function drawVerticalBar(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 160);
const stave = new TabStave(10, 10, 300);
stave.setNumLines(6);
stave.setContext(ctx);
stave.drawVerticalBar(50);
stave.drawVerticalBar(100);
stave.drawVerticalBar(150);
stave.setEndBarType(Barline.type.END);
stave.draw();

ok(true, 'all pass');
}

export { TabStaveTests };

0 comments on commit eeeaf41

Please sign in to comment.