mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Rename Item#registration to Item#anchor
This commit is contained in:
parent
9e7fe2aa4e
commit
78a2685324
2 changed files with 20 additions and 20 deletions
|
@ -32,7 +32,7 @@
|
||||||
strokeWidth: 30,
|
strokeWidth: 30,
|
||||||
strokeJoin: 'round',
|
strokeJoin: 'round',
|
||||||
strokeCap: 'butt',
|
strokeCap: 'butt',
|
||||||
registration: leftPath.position,
|
anchor: leftPath.position,
|
||||||
position: view.center
|
position: view.center
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
}
|
}
|
||||||
leftPath.smooth();
|
leftPath.smooth();
|
||||||
rightPath.smooth();
|
rightPath.smooth();
|
||||||
group.registration = [leftPath.position.x, 0];
|
group.anchor = [leftPath.position.x, 0];
|
||||||
group.position = view.center;
|
group.position = view.center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
_serializeFields: {
|
_serializeFields: {
|
||||||
name: null,
|
name: null,
|
||||||
matrix: new Matrix(),
|
matrix: new Matrix(),
|
||||||
registration: null,
|
anchor: null,
|
||||||
locked: false,
|
locked: false,
|
||||||
visible: true,
|
visible: true,
|
||||||
blendMode: 'normal',
|
blendMode: 'normal',
|
||||||
|
@ -771,11 +771,11 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
// modified, it would hold new values already and only then cause the
|
// modified, it would hold new values already and only then cause the
|
||||||
// calling of #setPosition.
|
// calling of #setPosition.
|
||||||
if (!position) {
|
if (!position) {
|
||||||
// If a registration point is provided, use it to determine position
|
// If an anchor point is provided, use it to determine position
|
||||||
// base don the matrix. Otherwise use the center of the bounds.
|
// based on the matrix. Otherwise use the center of the bounds.
|
||||||
var registration = this._registration;
|
var anchor = this._anchor;
|
||||||
position = this._position = registration
|
position = this._position = anchor
|
||||||
? this._matrix._transformPoint(registration)
|
? this._matrix._transformPoint(anchor)
|
||||||
: this.getBounds().getCenter(true);
|
: this.getBounds().getCenter(true);
|
||||||
}
|
}
|
||||||
return new ctor(position.x, position.y, this, 'setPosition');
|
return new ctor(position.x, position.y, this, 'setPosition');
|
||||||
|
@ -788,19 +788,19 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
this.translate(Point.read(arguments).subtract(this.getPosition(true)));
|
this.translate(Point.read(arguments).subtract(this.getPosition(true)));
|
||||||
},
|
},
|
||||||
|
|
||||||
_registration: null,
|
_anchor: null,
|
||||||
|
|
||||||
getRegistration: function(/* dontLink */) {
|
getAnchor: function(/* dontLink */) {
|
||||||
var reg = this._registration;
|
var anchor = this._anchor;
|
||||||
if (reg) {
|
if (anchor) {
|
||||||
var ctor = arguments[0] ? Point : LinkedPoint;
|
var ctor = arguments[0] ? Point : LinkedPoint;
|
||||||
reg = new ctor(reg.x, reg.y, this, 'setRegistration');
|
anchor = new ctor(anchor.x, anchor.y, this, 'setAnchor');
|
||||||
}
|
}
|
||||||
return reg;
|
return anchor;
|
||||||
},
|
},
|
||||||
|
|
||||||
setRegistration: function(/* point */) {
|
setAnchor: function(/* point */) {
|
||||||
this._registration = Point.read(arguments);
|
this._anchor = Point.read(arguments);
|
||||||
// No need for _changed() since the only thing this affects is _position
|
// No need for _changed() since the only thing this affects is _position
|
||||||
delete this._position;
|
delete this._position;
|
||||||
}
|
}
|
||||||
|
@ -2758,15 +2758,15 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
var matrix = this._matrix;
|
var matrix = this._matrix;
|
||||||
if (this._applyMatrix(matrix, true)) {
|
if (this._applyMatrix(matrix, true)) {
|
||||||
// When the matrix could be applied, we also need to transform
|
// When the matrix could be applied, we also need to transform
|
||||||
// color styles (only gradients so far) and registration point:
|
// color styles (only gradients so far) and anchor point:
|
||||||
var registration = this._registration,
|
var anchor = this._anchor,
|
||||||
style = this._style,
|
style = this._style,
|
||||||
// pass true for dontMerge so we don't recursively transform
|
// pass true for dontMerge so we don't recursively transform
|
||||||
// styles on groups' children.
|
// styles on groups' children.
|
||||||
fillColor = style.getFillColor(true),
|
fillColor = style.getFillColor(true),
|
||||||
strokeColor = style.getStrokeColor(true);
|
strokeColor = style.getStrokeColor(true);
|
||||||
if (registration)
|
if (anchor)
|
||||||
registration.transform(matrix);
|
anchor.transform(matrix);
|
||||||
if (fillColor)
|
if (fillColor)
|
||||||
fillColor.transform(matrix);
|
fillColor.transform(matrix);
|
||||||
if (strokeColor)
|
if (strokeColor)
|
||||||
|
|
Loading…
Reference in a new issue