-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPart.js
48 lines (40 loc) · 1.19 KB
/
Part.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Part is a specialized subclass of ScoreComposite. It must contain a
* VoiceGroup and may contain a name.
* Under the hood, the VoiceGroup is at index 0 and the name is at index 1.
*/
Renderer.Part = function(id,name) {
Renderer.ScoreComposite.call(this,id);
this.controlPoint = 'topLeft';
this.add(new Renderer.VoiceGroup(null));
if (name) {
//this.add(new Renderer.Text(null,name));
}
};
Renderer.Part.prototype = new Renderer.ScoreComposite();
Renderer.Part.prototype.constructor = Renderer.Part;
Renderer.Part.prototype.addVoice = function(voice) {
this.voiceGroup.add(voice);
};
Renderer.Part.prototype.update = function(name) {
this.name = name;
};
Renderer.Part.prototype.accept = function(formatter) {
formatter.formatPart(this);
};
Object.defineProperty(Renderer.Part.prototype,"voiceGroup", {
get: function() {
return this.children[0];
},
set: function(voiceGroup) {
this.children[0] = voiceGroup;
}
});
Object.defineProperty(Renderer.Part.prototype,"name", {
get: function() {
//return this.children[1];
},
set: function(name) {
//this.children[1] = new Renderer.Text(null,name);
}
});