mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-27 22:29:11 -04:00
Merge remote-tracking branch 'origin/master'
Conflicts: src/tool/Tool.js
This commit is contained in:
commit
c89fcdcb2e
2 changed files with 13 additions and 4 deletions
src
|
@ -15,13 +15,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var CompoundPath = this.CompoundPath = PathItem.extend({
|
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.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];
|
||||||
|
// 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]);
|
this.appendTop(items[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,8 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
||||||
// If the event was triggered by a touch screen device,
|
// If the event was triggered by a touch screen device,
|
||||||
// prevent the default behaviour, as it will otherwise
|
// prevent the default behaviour, as it will otherwise
|
||||||
// scroll the page:
|
// scroll the page:
|
||||||
if (event && event.targetTouches) {
|
var touchDevice = event && event.targetTouches;
|
||||||
|
if (touchDevice) {
|
||||||
DomEvent.preventDefault(event);
|
DomEvent.preventDefault(event);
|
||||||
}
|
}
|
||||||
var point = event && viewToArtwork(event, that._document);
|
var point = event && viewToArtwork(event, that._document);
|
||||||
|
@ -64,7 +65,7 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
||||||
} else if (!dragging || onlyMove) {
|
} else if (!dragging || onlyMove) {
|
||||||
that.onHandleEvent('mousemove', point, event);
|
that.onHandleEvent('mousemove', point, event);
|
||||||
}
|
}
|
||||||
if (that.onMouseMove || that.onMouseDrag) {
|
if (that.onMouseMove || touchDevice && that.onMouseDrag) {
|
||||||
that._document.redraw();
|
that._document.redraw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue