Fix Group clipping and ignore Item#clipMask in the documentation for now.

This commit is contained in:
Jonathan Puckey 2011-06-14 12:15:46 +02:00
parent 8979537f14
commit 41feaebb4e
2 changed files with 6 additions and 3 deletions

View file

@ -103,10 +103,9 @@ var Group = this.Group = Item.extend({
draw: function(ctx, param) { draw: function(ctx, param) {
for (var i = 0, l = this._children.length; i < l; i++) { for (var i = 0, l = this._children.length; i < l; i++) {
// the group is clipped on its first child
param.clip = this._clipped && i == 0;
Item.draw(this._children[i], ctx, param); Item.draw(this._children[i], ctx, param);
// TODO: Shouldn't clipping paths not be filled / stroked?
if (this._clipped && i == 0)
ctx.clip();
} }
} }
}); });

View file

@ -273,6 +273,9 @@ var Item = this.Item = Base.extend({
*/ */
visible: true, visible: true,
// TODO Item#clipMask is currently not used for clipping - consider
// taking it out, as we could also simply always use the first child as the
// clipping mask.
/** /**
* Specifies whether the item defines a clip mask. This can only be set on * Specifies whether the item defines a clip mask. This can only be set on
* paths, compound paths, and text frame objects, and only if the item is * paths, compound paths, and text frame objects, and only if the item is
@ -281,6 +284,7 @@ var Item = this.Item = Base.extend({
* @type Boolean * @type Boolean
* @default false * @default false
* @bean * @bean
* @ignore // ignoring this until we actually make use of it for drawing
*/ */
isClipMask: function() { isClipMask: function() {
return this._clipMask; return this._clipMask;