diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 4974390..85d5239 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -33,8 +33,9 @@ * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner * * @member {PIXI.ObservablePoint} + * @private */ - this.anchor = new math.ObservablePoint(this.onAnchorUpdate, this); + this._anchor = new math.ObservablePoint(this.onAnchorUpdate, this); /** * The texture that the sprite is using @@ -368,7 +369,7 @@ { super.destroy(options); - this.anchor = null; + this._anchor = null; const destroyTexture = typeof options === 'boolean' ? options : options && options.texture; if (destroyTexture) @@ -465,6 +466,25 @@ this._height = value; } + /** + * The anchor sets the origin point of the texture. + * The default is 0,0 this means the texture's origin is the top left + * Setting the anchor to 0.5,0.5 means the texture's origin is centered + * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner + * + * @member {PIXI.ObservablePoint} + * @memberof PIXI.Sprite# + */ + get anchor() + { + return this._anchor; + } + + set anchor(value) + { + this._anchor.copy(value); + } + get tint() { return this._tint;