mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 13:52:06 -05:00
Use Path#setClockwise() in CompoundPath constructor to reverse top path so that the others appear as holes cut out from it.
This commit is contained in:
parent
813b70c70b
commit
3d76034600
1 changed files with 6 additions and 6 deletions
|
@ -15,18 +15,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var CompoundPath = this.CompoundPath = PathItem.extend({
|
var CompoundPath = this.CompoundPath = PathItem.extend({
|
||||||
// PORT: port the reversing of segments and keepDirection flag
|
initialize: function(items) {
|
||||||
initialize: function(items, keepDirection) {
|
|
||||||
this.base();
|
this.base();
|
||||||
this._children = [];
|
this._children = [];
|
||||||
if (items) {
|
if (items) {
|
||||||
for (var i = 0, l = items.length; i < l; i++) {
|
for (var i = 0, l = items.length; i < l; i++) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
// All paths except for the top one (last one in list) are
|
// All paths except for the top one (last one in list) are
|
||||||
// reversed when creating a compound path, so that they draw
|
// set to clockwise orientation when creating a compound path,
|
||||||
// holes. When keepDirection is set, children aren't reversed.
|
// so that they appear as holes, but only if their orientation
|
||||||
if (!keepDirection && i != l - 1)
|
// was not already specified before (= _clockwise is defined).
|
||||||
item.reverse();
|
if (item._clockwise === undefined)
|
||||||
|
item.setClockwise(i < l - 1);
|
||||||
this.appendTop(items[i]);
|
this.appendTop(items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue