feat: anchor/origin

This commit is contained in:
cha0s 2019-04-19 16:23:26 -05:00
parent a723065a92
commit 64b3022c44

View File

@ -13,6 +13,13 @@ export class Renderable extends decorate(class {}) {
this._zIndex = 0;
}
destroy() {
if (this.internal) {
this.internal.destroy();
delete this.internal;
}
}
get alpha() {
return this.internal.alpha;
}
@ -21,11 +28,19 @@ export class Renderable extends decorate(class {}) {
this.internal.alpha = alpha;
}
destroy() {
if (this.internal) {
this.internal.destroy();
delete this.internal;
}
get anchor() {
const anchor = this.internal.anchor || {x: 0, y: 0};
return [
anchor.x,
anchor.y,
];
}
set anchor(anchor) {
this.internal.anchor = {
x: anchor[0],
y: anchor[1],
};
}
get position() {
@ -56,7 +71,7 @@ export class Renderable extends decorate(class {}) {
set scale(scale) {
this.internal.scale = {
x: scale[0],
y: scale[1]
y: scale[1],
};
}