2011-04-21 08:21:56 -04:00
|
|
|
/**
|
|
|
|
* An internal version of Point that notifies its segment of each change
|
|
|
|
* Note: This prototype is not exported.
|
|
|
|
*/
|
|
|
|
var SegmentPoint = Point.extend({
|
|
|
|
beans: true,
|
|
|
|
|
|
|
|
set: function(x, y) {
|
|
|
|
this._x = x;
|
|
|
|
this._y = y;
|
2011-05-01 19:17:21 -04:00
|
|
|
this._segment._changed(this);
|
2011-04-21 08:21:56 -04:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
getX: function() {
|
|
|
|
return this._x;
|
|
|
|
},
|
|
|
|
|
|
|
|
setX: function(x) {
|
|
|
|
this._x = x;
|
2011-05-01 19:17:21 -04:00
|
|
|
this._segment._changed(this);
|
2011-04-21 08:21:56 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
getY: function() {
|
|
|
|
return this._y;
|
|
|
|
},
|
|
|
|
|
|
|
|
setY: function(y) {
|
|
|
|
this._y = y;
|
2011-05-01 19:17:21 -04:00
|
|
|
this._segment._changed(this);
|
2011-04-21 08:21:56 -04:00
|
|
|
},
|
2011-04-21 12:06:06 -04:00
|
|
|
|
|
|
|
setSelected: function(selected) {
|
2011-04-27 07:15:51 -04:00
|
|
|
this._segment._setSelected(this, selected);
|
2011-04-21 12:06:06 -04:00
|
|
|
},
|
|
|
|
|
2011-04-21 13:51:49 -04:00
|
|
|
isSelected: function() {
|
2011-04-27 07:15:51 -04:00
|
|
|
return this._segment._isSelected(this);
|
2011-04-21 12:06:06 -04:00
|
|
|
},
|
|
|
|
|
2011-04-21 08:21:56 -04:00
|
|
|
statics: {
|
2011-05-01 19:17:21 -04:00
|
|
|
create: function(segment, x, y) {
|
|
|
|
if (y === undefined) {
|
|
|
|
// Use the normal point constructor to read in point values
|
|
|
|
var tmp = new Point(x);
|
|
|
|
x = tmp.x;
|
|
|
|
y = tmp.y;
|
2011-04-21 08:21:56 -04:00
|
|
|
}
|
2011-05-01 19:17:21 -04:00
|
|
|
var point = new SegmentPoint(SegmentPoint.dont);
|
|
|
|
point._x = x;
|
|
|
|
point._y = y;
|
2011-04-21 08:21:56 -04:00
|
|
|
point._segment = segment;
|
|
|
|
return point;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|