File size: 1,071 Bytes
af6912c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
// abc_brace_element.js: Definition of the BraceElement class.
var BraceElem = function BraceElem(voice, type) {
this.startVoice = voice;
this.type = type;
};
BraceElem.prototype.setBottomStaff = function (voice) {
this.endVoice = voice;
// If only the start brace has a name then the name belongs to the brace instead of the staff.
if (this.startVoice.header && !this.endVoice.header) {
this.header = this.startVoice.header;
delete this.startVoice.header;
}
};
BraceElem.prototype.continuing = function (voice) {
// If the final staff isn't present, then use the last one we saw.
this.lastContinuedVoice = voice;
};
BraceElem.prototype.getWidth = function () {
return 10; // TODO-PER: right now the drawing function doesn't vary the width at all. If it does in the future then this will change.
};
BraceElem.prototype.isStartVoice = function (voice) {
if (this.startVoice && this.startVoice.staff && this.startVoice.staff.voices.length > 0 && this.startVoice.staff.voices[0] === voice)
return true;
return false;
};
module.exports = BraceElem;
|