Remove unnecessary Segment#getHandleIn/OutIfSet.

This commit is contained in:
Jürg Lehni 2011-07-01 12:30:10 +02:00
parent 79c0ad8cc5
commit 84bce71b1c
2 changed files with 6 additions and 15 deletions

View file

@ -1826,11 +1826,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
}
function addJoin(segment, join) {
var handleIn = segment.getHandleInIfSet(),
handleOut = segment.getHandleOutIfSet();
// When both handles are set in a segment, the join setting is
// ignored and round is always used.
if (join === 'round' || handleIn && handleOut) {
if (join === 'round' || !segment._handleIn.isZero()
&& !segment._handleOut.isZero()) {
bounds = bounds.unite(joinBounds.setCenter(matrix
? matrix.transform(segment._point) : segment._point));
} else if (join == 'bevel') {

View file

@ -143,11 +143,6 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
// this.corner = !this._handleIn.isColinear(this._handleOut);
},
getHandleInIfSet: function() {
return this._handleIn._x == 0 && this._handleIn._y == 0
? null : this._handleIn;
},
/**
* The handle point relative to the anchor point of the segment that
* describes the out tangent of the segment.
@ -167,11 +162,6 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
// this.corner = !this._handleIn.isColinear(this._handleOut);
},
getHandleOutIfSet: function() {
return this._handleOut._x == 0 && this._handleOut._y == 0
? null : this._handleOut;
},
_isSelected: function(point) {
var state = this._selectionState;
return point == this._point ? !!(state & SelectionState.POINT)
@ -346,8 +336,10 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
// This saves some computation time. If no matrix is set, always
// use the real handles, as we just want to receive a filled
// coords array for getBounds().
handleIn = matrix && this.getHandleInIfSet() || this._handleIn,
handleOut = matrix && this.getHandleOutIfSet() || this._handleOut,
handleIn = !matrix || !this._handleIn.isZero()
? this._handleIn : null,
handleOut = !matrix || !this._handleOut.isZero()
? this._handleOut : null,
x = point._x,
y = point._y,
i = 2;