From 3d760346006339b7b57ee962df9995274c8314cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 15 May 2011 18:05:00 +0100 Subject: [PATCH] Use Path#setClockwise() in CompoundPath constructor to reverse top path so that the others appear as holes cut out from it. --- src/path/CompoundPath.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 78305a7e..4608efe1 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -15,18 +15,18 @@ */ var CompoundPath = this.CompoundPath = PathItem.extend({ - // PORT: port the reversing of segments and keepDirection flag - initialize: function(items, keepDirection) { + initialize: function(items) { this.base(); this._children = []; if (items) { for (var i = 0, l = items.length; i < l; i++) { var item = items[i]; // All paths except for the top one (last one in list) are - // reversed when creating a compound path, so that they draw - // holes. When keepDirection is set, children aren't reversed. - if (!keepDirection && i != l - 1) - item.reverse(); + // set to clockwise orientation when creating a compound path, + // so that they appear as holes, but only if their orientation + // was not already specified before (= _clockwise is defined). + if (item._clockwise === undefined) + item.setClockwise(i < l - 1); this.appendTop(items[i]); } }