mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3afe7ea5bb
2 changed files with 32 additions and 3 deletions
|
@ -30,7 +30,8 @@ var GradientColor = this.GradientColor = Color.extend({
|
|||
},
|
||||
|
||||
setOrigin: function(origin) {
|
||||
origin = Point.read(arguments);
|
||||
// PORT: add clone to Scriptographer
|
||||
origin = Point.read(arguments).clone();
|
||||
this._origin = origin;
|
||||
if (this._destination)
|
||||
this._radius = this._destination.getDistance(this._origin);
|
||||
|
@ -42,7 +43,8 @@ var GradientColor = this.GradientColor = Color.extend({
|
|||
},
|
||||
|
||||
setDestination: function(destination) {
|
||||
destination = Point.read(arguments);
|
||||
// PORT: add clone to Scriptographer
|
||||
destination = Point.read(arguments).clone();
|
||||
this._destination = destination;
|
||||
this._radius = this._destination.getDistance(this._origin);
|
||||
return this;
|
||||
|
@ -53,7 +55,8 @@ var GradientColor = this.GradientColor = Color.extend({
|
|||
},
|
||||
|
||||
setHilite: function(hilite) {
|
||||
hilite = Point.read(arguments);
|
||||
// PORT: add clone to Scriptographer
|
||||
hilite = Point.read(arguments).clone();
|
||||
var vector = hilite.subtract(this._origin);
|
||||
if (vector.getLength() > this._radius) {
|
||||
this._hilite = this._origin.add(vector.normalize(
|
||||
|
@ -96,5 +99,27 @@ var GradientColor = this.GradientColor = Color.extend({
|
|||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
transform: function(matrix) {
|
||||
var origin = this._origin,
|
||||
destination = this._destination,
|
||||
hilite = this._hilite,
|
||||
coords = [ origin.x, origin.y, destination.x, destination.y];
|
||||
if (hilite) {
|
||||
coords[4] = hilite.x;
|
||||
coords[5] = hilite.y;
|
||||
}
|
||||
matrix._transformCoordinates(coords, 0, coords, 0,
|
||||
this._hilite ? 3 : 2);
|
||||
origin.x = coords[0];
|
||||
origin.y = coords[1];
|
||||
destination.x = coords[2];
|
||||
destination.y = coords[3];
|
||||
this._radius = destination.getDistance(origin);
|
||||
if (hilite) {
|
||||
hilite.x = coords[4];
|
||||
hilite.y = coords[5];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -130,6 +130,10 @@ var Path = this.Path = PathItem.extend({
|
|||
for (var i = 0, l = this._segments.length; i < l; i++) {
|
||||
this._segments[i]._transformCoordinates(matrix, coords, true);
|
||||
}
|
||||
if (this.fillColor && this.fillColor.transform)
|
||||
this.fillColor.transform(matrix);
|
||||
if (this.strokeColor && this.strokeColor.transform)
|
||||
this.strokeColor.transform(matrix);
|
||||
}
|
||||
this._changed(ChangeFlags.PATH);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue