Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvilarl committed May 7, 2021
1 parent dc3d9c8 commit c273bfb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/barnote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import { Vex } from './vex';
import { Note } from './note';
import { Barline } from './stavebarline';
import { Barline, BarlineType } from './stavebarline';

export interface BarnoteMetrics {
widths: Record<string, number>;
Expand All @@ -26,7 +26,7 @@ function L(
export class BarNote extends Note {
protected metrics: BarnoteMetrics;
static DEBUG: boolean;
protected type!: number;
protected type!: BarlineType;

constructor(type = Barline.type.SINGLE) {
super({ duration: 'b' });
Expand All @@ -53,11 +53,11 @@ export class BarNote extends Note {
}

// Get and set the type of Bar note. `type` must be one of `Vex.Flow.Barline.type`.
getType(): number {
getType(): BarlineType {
return this.type;
}

setType(type: string | number): this {
setType(type: string | BarlineType): this {
this.type = typeof type === 'string' ? Barline.typeString[type] : type;

// Set width to width of relevant `Barline`.
Expand Down
5 changes: 3 additions & 2 deletions src/stavebarline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum BarlineType {
REPEAT_BOTH = 6,
NONE = 7,
}

export class Barline extends StaveModifier {
protected widths: Record<string, number>;
protected paddings: Record<string, number>;
Expand All @@ -31,7 +32,7 @@ export class Barline extends StaveModifier {
return BarlineType;
}

static get typeString(): Record<string, number> {
static get typeString(): Record<string, BarlineType> {
return {
single: Barline.type.SINGLE,
double: Barline.type.DOUBLE,
Expand All @@ -46,7 +47,7 @@ export class Barline extends StaveModifier {
/**
* @constructor
*/
constructor(type: number | string) {
constructor(type: BarlineType | string) {
super();
this.setAttribute('type', 'Barline');
this.thickness = Flow.STAVE_LINE_THICKNESS;
Expand Down

0 comments on commit c273bfb

Please sign in to comment.