Change SegmentPoint.create() to copy over selected state from a provided other point or object.

This commit is contained in:
Jürg Lehni 2011-05-21 14:27:29 +01:00
parent b461368b18
commit 2b5d648e96

View file

@ -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;
}
}