Change Point#set() calls back to clearer multi-line notation.

This commit is contained in:
Jürg Lehni 2011-05-01 23:36:08 +01:00
parent 756c4f37c5
commit 51e5a29a9d

View file

@ -153,14 +153,20 @@ var Point = this.Point = Base.extend({
// so LinkedPoint does not report changes twice. // so LinkedPoint does not report changes twice.
if (this.isZero()) { if (this.isZero()) {
var angle = this._angle || 0; var angle = this._angle || 0;
this.set(Math.cos(angle) * length, Math.sin(angle) * length); this.set(
Math.cos(angle) * length,
Math.sin(angle) * length
);
} else { } else {
var scale = length / this.getLength(); var scale = length / this.getLength();
// Force calculation of angle now, so it will be preserved even when // Force calculation of angle now, so it will be preserved even when
// x and y are 0 // x and y are 0
if (scale == 0) if (scale == 0)
this.getAngle(); this.getAngle();
this.set(this.x * scale, this.y * scale); this.set(
this.x * scale,
this.y * scale
);
} }
return this; return this;
}, },
@ -203,8 +209,8 @@ var Point = this.Point = Base.extend({
angle = this._angle = angle * Math.PI / 180; angle = this._angle = angle * Math.PI / 180;
if (!this.isZero()) { if (!this.isZero()) {
var length = this.getLength(); var length = this.getLength();
// Use #set() instead of direct assignment, so LinkedPoint // Use #set() instead of direct assignment of x/y, so LinkedPoint
// can optimise // does not report changes twice.
this.set( this.set(
Math.cos(angle) * length, Math.cos(angle) * length,
Math.sin(angle) * length Math.sin(angle) * length