mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Change SegmentPoint.create() to copy over selected state from a provided other point or object.
This commit is contained in:
parent
b461368b18
commit
2b5d648e96
1 changed files with 7 additions and 4 deletions
|
@ -55,17 +55,20 @@ var SegmentPoint = Point.extend({
|
|||
},
|
||||
|
||||
statics: {
|
||||
create: function(segment, x, y) {
|
||||
create: function(segment, x, y, selected) {
|
||||
if (y === undefined) {
|
||||
// Use the normal point constructor to read in point values
|
||||
var tmp = new Point(x);
|
||||
x = tmp.x;
|
||||
y = tmp.y;
|
||||
var pt = x instanceof Point ? x : new Point(x);
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
selected = pt.selected;
|
||||
}
|
||||
var point = new SegmentPoint(SegmentPoint.dont);
|
||||
point._x = x;
|
||||
point._y = y;
|
||||
point._owner = segment;
|
||||
if (selected)
|
||||
point.setSelected(true);
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue