2011-02-12 13:12:23 -05:00
|
|
|
Group = Item.extend({
|
|
|
|
initialize: function(items) {
|
|
|
|
this.base();
|
2011-02-11 12:37:36 -05:00
|
|
|
this.children = [];
|
2011-02-12 13:12:23 -05:00
|
|
|
if(items) {
|
|
|
|
for(var i = 0, l = items.length; i < l; i++) {
|
|
|
|
this.appendTop(items[i]);
|
|
|
|
}
|
|
|
|
}
|
2011-02-11 12:37:36 -05:00
|
|
|
this.clipped = false;
|
|
|
|
},
|
|
|
|
|
2011-02-12 13:12:23 -05:00
|
|
|
draw: function(ctx) {
|
2011-02-11 12:37:36 -05:00
|
|
|
for(var i = 0, l = this.children.length; i < l; i++) {
|
2011-02-12 13:12:23 -05:00
|
|
|
this.children[i].draw(ctx);
|
2011-02-11 12:37:36 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specifies whether the group item is to be clipped.
|
|
|
|
* When setting to true, the first child in the group is automatically
|
|
|
|
* defined as the clipping mask.
|
|
|
|
*
|
|
|
|
* Sample code:
|
|
|
|
* <code>
|
|
|
|
* var group = new Group();
|
|
|
|
* group.appendChild(path);
|
|
|
|
* group.clipped = true;
|
|
|
|
* </code>
|
|
|
|
* @return {@true if the group item is to be clipped}
|
|
|
|
*/
|
|
|
|
isClipped: function() {
|
|
|
|
return this.clipped;
|
|
|
|
},
|
|
|
|
|
|
|
|
setClipped: function(clipped) {
|
|
|
|
this.clipped = clipped;
|
|
|
|
var child = this.firstChild;
|
|
|
|
if(child)
|
|
|
|
child.setClipMask(clipped);
|
|
|
|
}
|
|
|
|
});
|