mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Prebuilt module for commit 1db419a87b
This commit is contained in:
parent
6948148bb0
commit
f76d45ce3a
5 changed files with 136 additions and 136 deletions
80
dist/docs/assets/js/paper.js
vendored
80
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Fri Feb 26 15:13:49 2016 +0100
|
* Date: Fri Feb 26 16:31:50 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -2010,7 +2010,7 @@ new function() {
|
||||||
var owner = this._owner;
|
var owner = this._owner;
|
||||||
if (owner.setSelected) {
|
if (owner.setSelected) {
|
||||||
owner._boundsSelected = selected;
|
owner._boundsSelected = selected;
|
||||||
owner.setSelected(selected || owner._selectedSegmentState > 0);
|
owner.setSelected(selected || owner._segmentSelection > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -5338,6 +5338,7 @@ var HitResult = Base.extend({
|
||||||
var Segment = Base.extend({
|
var Segment = Base.extend({
|
||||||
_class: 'Segment',
|
_class: 'Segment',
|
||||||
beans: true,
|
beans: true,
|
||||||
|
_selection: 0,
|
||||||
|
|
||||||
initialize: function Segment(arg0, arg1, arg2, arg3, arg4, arg5) {
|
initialize: function Segment(arg0, arg1, arg2, arg3, arg4, arg5) {
|
||||||
var count = arguments.length,
|
var count = arguments.length,
|
||||||
|
@ -5429,35 +5430,32 @@ var Segment = Base.extend({
|
||||||
this._handleOut.set(0, 0);
|
this._handleOut.set(0, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectionState: 0,
|
_getSelectionFlag: function(point) {
|
||||||
|
return !point ? 7
|
||||||
|
: point === this._point ? 4
|
||||||
|
: point === this._handleIn ? 1
|
||||||
|
: point === this._handleOut ? 2
|
||||||
|
: 0;
|
||||||
|
},
|
||||||
|
|
||||||
isSelected: function(_point) {
|
isSelected: function(_point) {
|
||||||
var state = this._selectionState;
|
return !!(this._selection & this._getSelectionFlag(_point));
|
||||||
return !_point ? !!(state & 7)
|
|
||||||
: _point === this._point ? !!(state & 4)
|
|
||||||
: _point === this._handleIn ? !!(state & 1)
|
|
||||||
: _point === this._handleOut ? !!(state & 2)
|
|
||||||
: false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setSelected: function(selected, _point) {
|
setSelected: function(selected, _point) {
|
||||||
var path = this._path,
|
var path = this._path,
|
||||||
selected = !!selected,
|
selected = !!selected,
|
||||||
state = this._selectionState,
|
selection = this._selection,
|
||||||
oldState = state,
|
oldSelection = selection,
|
||||||
flag = !_point ? 7
|
flag = this._getSelectionFlag(_point);
|
||||||
: _point === this._point ? 4
|
|
||||||
: _point === this._handleIn ? 1
|
|
||||||
: _point === this._handleOut ? 2
|
|
||||||
: 0;
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
state |= flag;
|
selection |= flag;
|
||||||
} else {
|
} else {
|
||||||
state &= ~flag;
|
selection &= ~flag;
|
||||||
}
|
}
|
||||||
this._selectionState = state;
|
this._selection = selection;
|
||||||
if (path && state !== oldState) {
|
if (path && selection !== oldSelection) {
|
||||||
path._updateSelection(this, oldState, state);
|
path._updateSelection(this, oldSelection, selection);
|
||||||
path._changed(129);
|
path._changed(129);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -7496,7 +7494,7 @@ var Path = PathItem.extend({
|
||||||
this.setSegments(segments);
|
this.setSegments(segments);
|
||||||
} else {
|
} else {
|
||||||
this._curves = undefined;
|
this._curves = undefined;
|
||||||
this._selectedSegmentState = 0;
|
this._segmentSelection = 0;
|
||||||
if (!segments && typeof arg === 'string') {
|
if (!segments && typeof arg === 'string') {
|
||||||
this.setPathData(arg);
|
this.setPathData(arg);
|
||||||
arg = null;
|
arg = null;
|
||||||
|
@ -7546,7 +7544,7 @@ var Path = PathItem.extend({
|
||||||
setSegments: function(segments) {
|
setSegments: function(segments) {
|
||||||
var fullySelected = this.isFullySelected();
|
var fullySelected = this.isFullySelected();
|
||||||
this._segments.length = 0;
|
this._segments.length = 0;
|
||||||
this._selectedSegmentState = 0;
|
this._segmentSelection = 0;
|
||||||
this._curves = undefined;
|
this._curves = undefined;
|
||||||
if (segments && segments.length > 0)
|
if (segments && segments.length > 0)
|
||||||
this._add(Segment.readAll(segments));
|
this._add(Segment.readAll(segments));
|
||||||
|
@ -7678,8 +7676,8 @@ var Path = PathItem.extend({
|
||||||
segment = segs[i] = segment.clone();
|
segment = segs[i] = segment.clone();
|
||||||
segment._path = this;
|
segment._path = this;
|
||||||
segment._index = index + i;
|
segment._index = index + i;
|
||||||
if (segment._selectionState)
|
if (segment._selection)
|
||||||
this._updateSelection(segment, 0, segment._selectionState);
|
this._updateSelection(segment, 0, segment._selection);
|
||||||
}
|
}
|
||||||
if (append) {
|
if (append) {
|
||||||
segments.push.apply(segments, segs);
|
segments.push.apply(segments, segs);
|
||||||
|
@ -7777,8 +7775,8 @@ var Path = PathItem.extend({
|
||||||
return removed;
|
return removed;
|
||||||
for (var i = 0; i < amount; i++) {
|
for (var i = 0; i < amount; i++) {
|
||||||
var segment = removed[i];
|
var segment = removed[i];
|
||||||
if (segment._selectionState)
|
if (segment._selection)
|
||||||
this._updateSelection(segment, segment._selectionState, 0);
|
this._updateSelection(segment, segment._selection, 0);
|
||||||
segment._index = segment._path = null;
|
segment._index = segment._path = null;
|
||||||
}
|
}
|
||||||
for (var i = start, l = segments.length; i < l; i++)
|
for (var i = start, l = segments.length; i < l; i++)
|
||||||
|
@ -7855,7 +7853,7 @@ var Path = PathItem.extend({
|
||||||
|
|
||||||
isFullySelected: function() {
|
isFullySelected: function() {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
return this._selected && length > 0 && this._selectedSegmentState
|
return this._selected && length > 0 && this._segmentSelection
|
||||||
=== length * 7;
|
=== length * 7;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -7873,17 +7871,18 @@ var Path = PathItem.extend({
|
||||||
|
|
||||||
_selectSegments: function(selected) {
|
_selectSegments: function(selected) {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
this._selectedSegmentState = selected
|
this._segmentSelection = selected
|
||||||
? length * 7 : 0;
|
? length * 7 : 0;
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++) {
|
||||||
this._segments[i]._selectionState = selected
|
this._segments[i]._selection = selected
|
||||||
? 7 : 0;
|
? 7 : 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelection: function(segment, oldState, newState) {
|
_updateSelection: function(segment, oldSelection, newSelection) {
|
||||||
segment._selectionState = newState;
|
segment._selection = newSelection;
|
||||||
var total = this._selectedSegmentState += newState - oldState;
|
var selection = this._segmentSelection += newSelection - oldSelection;
|
||||||
if (total > 0)
|
if (selection > 0)
|
||||||
this.setSelected(true);
|
this.setSelected(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -8404,15 +8403,15 @@ new function() {
|
||||||
for (var i = 0, l = segments.length; i < l; i++) {
|
for (var i = 0, l = segments.length; i < l; i++) {
|
||||||
var segment = segments[i];
|
var segment = segments[i];
|
||||||
segment._transformCoordinates(matrix, coords);
|
segment._transformCoordinates(matrix, coords);
|
||||||
var state = segment._selectionState,
|
var selection = segment._selection,
|
||||||
pX = coords[0],
|
pX = coords[0],
|
||||||
pY = coords[1];
|
pY = coords[1];
|
||||||
if (state & 1)
|
if (selection & 1)
|
||||||
drawHandle(2);
|
drawHandle(2);
|
||||||
if (state & 2)
|
if (selection & 2)
|
||||||
drawHandle(4);
|
drawHandle(4);
|
||||||
ctx.fillRect(pX - half, pY - half, size, size);
|
ctx.fillRect(pX - half, pY - half, size, size);
|
||||||
if (!(state & 4)) {
|
if (!(selection & 4)) {
|
||||||
var fillStyle = ctx.fillStyle;
|
var fillStyle = ctx.fillStyle;
|
||||||
ctx.fillStyle = '#ffffff';
|
ctx.fillStyle = '#ffffff';
|
||||||
ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2);
|
ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2);
|
||||||
|
@ -9258,9 +9257,10 @@ var CompoundPath = PathItem.extend({
|
||||||
for (var i = 0, l = children.length; i < l; i++) {
|
for (var i = 0, l = children.length; i < l; i++) {
|
||||||
var child = children[i],
|
var child = children[i],
|
||||||
mx = child._matrix;
|
mx = child._matrix;
|
||||||
if (!selectedItems[child._id])
|
if (!selectedItems[child._id]) {
|
||||||
child._drawSelected(ctx, mx.isIdentity() ? matrix
|
child._drawSelected(ctx, mx.isIdentity() ? matrix
|
||||||
: matrix.appended(mx));
|
: matrix.appended(mx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
80
dist/paper-core.js
vendored
80
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Fri Feb 26 15:13:49 2016 +0100
|
* Date: Fri Feb 26 16:31:50 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -2010,7 +2010,7 @@ new function() {
|
||||||
var owner = this._owner;
|
var owner = this._owner;
|
||||||
if (owner.setSelected) {
|
if (owner.setSelected) {
|
||||||
owner._boundsSelected = selected;
|
owner._boundsSelected = selected;
|
||||||
owner.setSelected(selected || owner._selectedSegmentState > 0);
|
owner.setSelected(selected || owner._segmentSelection > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -5338,6 +5338,7 @@ var HitResult = Base.extend({
|
||||||
var Segment = Base.extend({
|
var Segment = Base.extend({
|
||||||
_class: 'Segment',
|
_class: 'Segment',
|
||||||
beans: true,
|
beans: true,
|
||||||
|
_selection: 0,
|
||||||
|
|
||||||
initialize: function Segment(arg0, arg1, arg2, arg3, arg4, arg5) {
|
initialize: function Segment(arg0, arg1, arg2, arg3, arg4, arg5) {
|
||||||
var count = arguments.length,
|
var count = arguments.length,
|
||||||
|
@ -5429,35 +5430,32 @@ var Segment = Base.extend({
|
||||||
this._handleOut.set(0, 0);
|
this._handleOut.set(0, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectionState: 0,
|
_getSelectionFlag: function(point) {
|
||||||
|
return !point ? 7
|
||||||
|
: point === this._point ? 4
|
||||||
|
: point === this._handleIn ? 1
|
||||||
|
: point === this._handleOut ? 2
|
||||||
|
: 0;
|
||||||
|
},
|
||||||
|
|
||||||
isSelected: function(_point) {
|
isSelected: function(_point) {
|
||||||
var state = this._selectionState;
|
return !!(this._selection & this._getSelectionFlag(_point));
|
||||||
return !_point ? !!(state & 7)
|
|
||||||
: _point === this._point ? !!(state & 4)
|
|
||||||
: _point === this._handleIn ? !!(state & 1)
|
|
||||||
: _point === this._handleOut ? !!(state & 2)
|
|
||||||
: false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setSelected: function(selected, _point) {
|
setSelected: function(selected, _point) {
|
||||||
var path = this._path,
|
var path = this._path,
|
||||||
selected = !!selected,
|
selected = !!selected,
|
||||||
state = this._selectionState,
|
selection = this._selection,
|
||||||
oldState = state,
|
oldSelection = selection,
|
||||||
flag = !_point ? 7
|
flag = this._getSelectionFlag(_point);
|
||||||
: _point === this._point ? 4
|
|
||||||
: _point === this._handleIn ? 1
|
|
||||||
: _point === this._handleOut ? 2
|
|
||||||
: 0;
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
state |= flag;
|
selection |= flag;
|
||||||
} else {
|
} else {
|
||||||
state &= ~flag;
|
selection &= ~flag;
|
||||||
}
|
}
|
||||||
this._selectionState = state;
|
this._selection = selection;
|
||||||
if (path && state !== oldState) {
|
if (path && selection !== oldSelection) {
|
||||||
path._updateSelection(this, oldState, state);
|
path._updateSelection(this, oldSelection, selection);
|
||||||
path._changed(129);
|
path._changed(129);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -7496,7 +7494,7 @@ var Path = PathItem.extend({
|
||||||
this.setSegments(segments);
|
this.setSegments(segments);
|
||||||
} else {
|
} else {
|
||||||
this._curves = undefined;
|
this._curves = undefined;
|
||||||
this._selectedSegmentState = 0;
|
this._segmentSelection = 0;
|
||||||
if (!segments && typeof arg === 'string') {
|
if (!segments && typeof arg === 'string') {
|
||||||
this.setPathData(arg);
|
this.setPathData(arg);
|
||||||
arg = null;
|
arg = null;
|
||||||
|
@ -7546,7 +7544,7 @@ var Path = PathItem.extend({
|
||||||
setSegments: function(segments) {
|
setSegments: function(segments) {
|
||||||
var fullySelected = this.isFullySelected();
|
var fullySelected = this.isFullySelected();
|
||||||
this._segments.length = 0;
|
this._segments.length = 0;
|
||||||
this._selectedSegmentState = 0;
|
this._segmentSelection = 0;
|
||||||
this._curves = undefined;
|
this._curves = undefined;
|
||||||
if (segments && segments.length > 0)
|
if (segments && segments.length > 0)
|
||||||
this._add(Segment.readAll(segments));
|
this._add(Segment.readAll(segments));
|
||||||
|
@ -7678,8 +7676,8 @@ var Path = PathItem.extend({
|
||||||
segment = segs[i] = segment.clone();
|
segment = segs[i] = segment.clone();
|
||||||
segment._path = this;
|
segment._path = this;
|
||||||
segment._index = index + i;
|
segment._index = index + i;
|
||||||
if (segment._selectionState)
|
if (segment._selection)
|
||||||
this._updateSelection(segment, 0, segment._selectionState);
|
this._updateSelection(segment, 0, segment._selection);
|
||||||
}
|
}
|
||||||
if (append) {
|
if (append) {
|
||||||
segments.push.apply(segments, segs);
|
segments.push.apply(segments, segs);
|
||||||
|
@ -7777,8 +7775,8 @@ var Path = PathItem.extend({
|
||||||
return removed;
|
return removed;
|
||||||
for (var i = 0; i < amount; i++) {
|
for (var i = 0; i < amount; i++) {
|
||||||
var segment = removed[i];
|
var segment = removed[i];
|
||||||
if (segment._selectionState)
|
if (segment._selection)
|
||||||
this._updateSelection(segment, segment._selectionState, 0);
|
this._updateSelection(segment, segment._selection, 0);
|
||||||
segment._index = segment._path = null;
|
segment._index = segment._path = null;
|
||||||
}
|
}
|
||||||
for (var i = start, l = segments.length; i < l; i++)
|
for (var i = start, l = segments.length; i < l; i++)
|
||||||
|
@ -7855,7 +7853,7 @@ var Path = PathItem.extend({
|
||||||
|
|
||||||
isFullySelected: function() {
|
isFullySelected: function() {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
return this._selected && length > 0 && this._selectedSegmentState
|
return this._selected && length > 0 && this._segmentSelection
|
||||||
=== length * 7;
|
=== length * 7;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -7873,17 +7871,18 @@ var Path = PathItem.extend({
|
||||||
|
|
||||||
_selectSegments: function(selected) {
|
_selectSegments: function(selected) {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
this._selectedSegmentState = selected
|
this._segmentSelection = selected
|
||||||
? length * 7 : 0;
|
? length * 7 : 0;
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++) {
|
||||||
this._segments[i]._selectionState = selected
|
this._segments[i]._selection = selected
|
||||||
? 7 : 0;
|
? 7 : 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelection: function(segment, oldState, newState) {
|
_updateSelection: function(segment, oldSelection, newSelection) {
|
||||||
segment._selectionState = newState;
|
segment._selection = newSelection;
|
||||||
var total = this._selectedSegmentState += newState - oldState;
|
var selection = this._segmentSelection += newSelection - oldSelection;
|
||||||
if (total > 0)
|
if (selection > 0)
|
||||||
this.setSelected(true);
|
this.setSelected(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -8404,15 +8403,15 @@ new function() {
|
||||||
for (var i = 0, l = segments.length; i < l; i++) {
|
for (var i = 0, l = segments.length; i < l; i++) {
|
||||||
var segment = segments[i];
|
var segment = segments[i];
|
||||||
segment._transformCoordinates(matrix, coords);
|
segment._transformCoordinates(matrix, coords);
|
||||||
var state = segment._selectionState,
|
var selection = segment._selection,
|
||||||
pX = coords[0],
|
pX = coords[0],
|
||||||
pY = coords[1];
|
pY = coords[1];
|
||||||
if (state & 1)
|
if (selection & 1)
|
||||||
drawHandle(2);
|
drawHandle(2);
|
||||||
if (state & 2)
|
if (selection & 2)
|
||||||
drawHandle(4);
|
drawHandle(4);
|
||||||
ctx.fillRect(pX - half, pY - half, size, size);
|
ctx.fillRect(pX - half, pY - half, size, size);
|
||||||
if (!(state & 4)) {
|
if (!(selection & 4)) {
|
||||||
var fillStyle = ctx.fillStyle;
|
var fillStyle = ctx.fillStyle;
|
||||||
ctx.fillStyle = '#ffffff';
|
ctx.fillStyle = '#ffffff';
|
||||||
ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2);
|
ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2);
|
||||||
|
@ -9258,9 +9257,10 @@ var CompoundPath = PathItem.extend({
|
||||||
for (var i = 0, l = children.length; i < l; i++) {
|
for (var i = 0, l = children.length; i < l; i++) {
|
||||||
var child = children[i],
|
var child = children[i],
|
||||||
mx = child._matrix;
|
mx = child._matrix;
|
||||||
if (!selectedItems[child._id])
|
if (!selectedItems[child._id]) {
|
||||||
child._drawSelected(ctx, mx.isIdentity() ? matrix
|
child._drawSelected(ctx, mx.isIdentity() ? matrix
|
||||||
: matrix.appended(mx));
|
: matrix.appended(mx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
16
dist/paper-core.min.js
vendored
16
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
80
dist/paper-full.js
vendored
80
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Fri Feb 26 15:13:49 2016 +0100
|
* Date: Fri Feb 26 16:31:50 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -2010,7 +2010,7 @@ new function() {
|
||||||
var owner = this._owner;
|
var owner = this._owner;
|
||||||
if (owner.setSelected) {
|
if (owner.setSelected) {
|
||||||
owner._boundsSelected = selected;
|
owner._boundsSelected = selected;
|
||||||
owner.setSelected(selected || owner._selectedSegmentState > 0);
|
owner.setSelected(selected || owner._segmentSelection > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -5338,6 +5338,7 @@ var HitResult = Base.extend({
|
||||||
var Segment = Base.extend({
|
var Segment = Base.extend({
|
||||||
_class: 'Segment',
|
_class: 'Segment',
|
||||||
beans: true,
|
beans: true,
|
||||||
|
_selection: 0,
|
||||||
|
|
||||||
initialize: function Segment(arg0, arg1, arg2, arg3, arg4, arg5) {
|
initialize: function Segment(arg0, arg1, arg2, arg3, arg4, arg5) {
|
||||||
var count = arguments.length,
|
var count = arguments.length,
|
||||||
|
@ -5429,35 +5430,32 @@ var Segment = Base.extend({
|
||||||
this._handleOut.set(0, 0);
|
this._handleOut.set(0, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectionState: 0,
|
_getSelectionFlag: function(point) {
|
||||||
|
return !point ? 7
|
||||||
|
: point === this._point ? 4
|
||||||
|
: point === this._handleIn ? 1
|
||||||
|
: point === this._handleOut ? 2
|
||||||
|
: 0;
|
||||||
|
},
|
||||||
|
|
||||||
isSelected: function(_point) {
|
isSelected: function(_point) {
|
||||||
var state = this._selectionState;
|
return !!(this._selection & this._getSelectionFlag(_point));
|
||||||
return !_point ? !!(state & 7)
|
|
||||||
: _point === this._point ? !!(state & 4)
|
|
||||||
: _point === this._handleIn ? !!(state & 1)
|
|
||||||
: _point === this._handleOut ? !!(state & 2)
|
|
||||||
: false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setSelected: function(selected, _point) {
|
setSelected: function(selected, _point) {
|
||||||
var path = this._path,
|
var path = this._path,
|
||||||
selected = !!selected,
|
selected = !!selected,
|
||||||
state = this._selectionState,
|
selection = this._selection,
|
||||||
oldState = state,
|
oldSelection = selection,
|
||||||
flag = !_point ? 7
|
flag = this._getSelectionFlag(_point);
|
||||||
: _point === this._point ? 4
|
|
||||||
: _point === this._handleIn ? 1
|
|
||||||
: _point === this._handleOut ? 2
|
|
||||||
: 0;
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
state |= flag;
|
selection |= flag;
|
||||||
} else {
|
} else {
|
||||||
state &= ~flag;
|
selection &= ~flag;
|
||||||
}
|
}
|
||||||
this._selectionState = state;
|
this._selection = selection;
|
||||||
if (path && state !== oldState) {
|
if (path && selection !== oldSelection) {
|
||||||
path._updateSelection(this, oldState, state);
|
path._updateSelection(this, oldSelection, selection);
|
||||||
path._changed(129);
|
path._changed(129);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -7496,7 +7494,7 @@ var Path = PathItem.extend({
|
||||||
this.setSegments(segments);
|
this.setSegments(segments);
|
||||||
} else {
|
} else {
|
||||||
this._curves = undefined;
|
this._curves = undefined;
|
||||||
this._selectedSegmentState = 0;
|
this._segmentSelection = 0;
|
||||||
if (!segments && typeof arg === 'string') {
|
if (!segments && typeof arg === 'string') {
|
||||||
this.setPathData(arg);
|
this.setPathData(arg);
|
||||||
arg = null;
|
arg = null;
|
||||||
|
@ -7546,7 +7544,7 @@ var Path = PathItem.extend({
|
||||||
setSegments: function(segments) {
|
setSegments: function(segments) {
|
||||||
var fullySelected = this.isFullySelected();
|
var fullySelected = this.isFullySelected();
|
||||||
this._segments.length = 0;
|
this._segments.length = 0;
|
||||||
this._selectedSegmentState = 0;
|
this._segmentSelection = 0;
|
||||||
this._curves = undefined;
|
this._curves = undefined;
|
||||||
if (segments && segments.length > 0)
|
if (segments && segments.length > 0)
|
||||||
this._add(Segment.readAll(segments));
|
this._add(Segment.readAll(segments));
|
||||||
|
@ -7678,8 +7676,8 @@ var Path = PathItem.extend({
|
||||||
segment = segs[i] = segment.clone();
|
segment = segs[i] = segment.clone();
|
||||||
segment._path = this;
|
segment._path = this;
|
||||||
segment._index = index + i;
|
segment._index = index + i;
|
||||||
if (segment._selectionState)
|
if (segment._selection)
|
||||||
this._updateSelection(segment, 0, segment._selectionState);
|
this._updateSelection(segment, 0, segment._selection);
|
||||||
}
|
}
|
||||||
if (append) {
|
if (append) {
|
||||||
segments.push.apply(segments, segs);
|
segments.push.apply(segments, segs);
|
||||||
|
@ -7777,8 +7775,8 @@ var Path = PathItem.extend({
|
||||||
return removed;
|
return removed;
|
||||||
for (var i = 0; i < amount; i++) {
|
for (var i = 0; i < amount; i++) {
|
||||||
var segment = removed[i];
|
var segment = removed[i];
|
||||||
if (segment._selectionState)
|
if (segment._selection)
|
||||||
this._updateSelection(segment, segment._selectionState, 0);
|
this._updateSelection(segment, segment._selection, 0);
|
||||||
segment._index = segment._path = null;
|
segment._index = segment._path = null;
|
||||||
}
|
}
|
||||||
for (var i = start, l = segments.length; i < l; i++)
|
for (var i = start, l = segments.length; i < l; i++)
|
||||||
|
@ -7855,7 +7853,7 @@ var Path = PathItem.extend({
|
||||||
|
|
||||||
isFullySelected: function() {
|
isFullySelected: function() {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
return this._selected && length > 0 && this._selectedSegmentState
|
return this._selected && length > 0 && this._segmentSelection
|
||||||
=== length * 7;
|
=== length * 7;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -7873,17 +7871,18 @@ var Path = PathItem.extend({
|
||||||
|
|
||||||
_selectSegments: function(selected) {
|
_selectSegments: function(selected) {
|
||||||
var length = this._segments.length;
|
var length = this._segments.length;
|
||||||
this._selectedSegmentState = selected
|
this._segmentSelection = selected
|
||||||
? length * 7 : 0;
|
? length * 7 : 0;
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++) {
|
||||||
this._segments[i]._selectionState = selected
|
this._segments[i]._selection = selected
|
||||||
? 7 : 0;
|
? 7 : 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelection: function(segment, oldState, newState) {
|
_updateSelection: function(segment, oldSelection, newSelection) {
|
||||||
segment._selectionState = newState;
|
segment._selection = newSelection;
|
||||||
var total = this._selectedSegmentState += newState - oldState;
|
var selection = this._segmentSelection += newSelection - oldSelection;
|
||||||
if (total > 0)
|
if (selection > 0)
|
||||||
this.setSelected(true);
|
this.setSelected(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -8404,15 +8403,15 @@ new function() {
|
||||||
for (var i = 0, l = segments.length; i < l; i++) {
|
for (var i = 0, l = segments.length; i < l; i++) {
|
||||||
var segment = segments[i];
|
var segment = segments[i];
|
||||||
segment._transformCoordinates(matrix, coords);
|
segment._transformCoordinates(matrix, coords);
|
||||||
var state = segment._selectionState,
|
var selection = segment._selection,
|
||||||
pX = coords[0],
|
pX = coords[0],
|
||||||
pY = coords[1];
|
pY = coords[1];
|
||||||
if (state & 1)
|
if (selection & 1)
|
||||||
drawHandle(2);
|
drawHandle(2);
|
||||||
if (state & 2)
|
if (selection & 2)
|
||||||
drawHandle(4);
|
drawHandle(4);
|
||||||
ctx.fillRect(pX - half, pY - half, size, size);
|
ctx.fillRect(pX - half, pY - half, size, size);
|
||||||
if (!(state & 4)) {
|
if (!(selection & 4)) {
|
||||||
var fillStyle = ctx.fillStyle;
|
var fillStyle = ctx.fillStyle;
|
||||||
ctx.fillStyle = '#ffffff';
|
ctx.fillStyle = '#ffffff';
|
||||||
ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2);
|
ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2);
|
||||||
|
@ -9258,9 +9257,10 @@ var CompoundPath = PathItem.extend({
|
||||||
for (var i = 0, l = children.length; i < l; i++) {
|
for (var i = 0, l = children.length; i < l; i++) {
|
||||||
var child = children[i],
|
var child = children[i],
|
||||||
mx = child._matrix;
|
mx = child._matrix;
|
||||||
if (!selectedItems[child._id])
|
if (!selectedItems[child._id]) {
|
||||||
child._drawSelected(ctx, mx.isIdentity() ? matrix
|
child._drawSelected(ctx, mx.isIdentity() ? matrix
|
||||||
: matrix.appended(mx));
|
: matrix.appended(mx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
16
dist/paper-full.min.js
vendored
16
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue