diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 772d1044..1189327a 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -15,12 +15,20 @@ */ var CompoundPath = this.CompoundPath = PathItem.extend({ - initialize: function(items) { + // PORT: port the reversing of segments and keepDirection flag + initialize: function(items, keepDirection) { this.base(); this.children = []; 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]; + // All paths except for the first one are reversed when + // creating a compound path, so that they draw holes. + // When keepDirection is set to true, child paths aren't reversed. + if (!keepDirection && i != l - 1) + item.reverse(); this.appendTop(items[i]); + } } }, diff --git a/src/tool/Tool.js b/src/tool/Tool.js index 869c97e6..f6b91afb 100644 --- a/src/tool/Tool.js +++ b/src/tool/Tool.js @@ -49,7 +49,8 @@ var Tool = this.Tool = ToolHandler.extend(new function() { // If the event was triggered by a touch screen device, // prevent the default behaviour, as it will otherwise // scroll the page: - if (event && event.targetTouches) { + var touchDevice = event && event.targetTouches; + if (touchDevice) { DomEvent.preventDefault(event); } var point = event && viewToArtwork(event, that._document); @@ -64,7 +65,7 @@ var Tool = this.Tool = ToolHandler.extend(new function() { } else if (!dragging || onlyMove) { that.onHandleEvent('mousemove', point, event); } - if (that.onMouseMove || that.onMouseDrag) { + if (that.onMouseMove || touchDevice && that.onMouseDrag) { that._document.redraw(); } },