refactor: stage ctor

This commit is contained in:
cha0s 2019-04-19 19:58:39 -05:00
parent eaf031257e
commit 5b6e399c30

View File

@ -13,8 +13,9 @@ const decorate = compose(
export class Stage extends decorate(Container) { export class Stage extends decorate(Container) {
constructor(size) { constructor(visibleSize, visibleScale) {
super(); super();
const size = Vector.mul(visibleSize, visibleScale);
// Container element. // Container element.
this.element = window.document.createElement('div'); this.element = window.document.createElement('div');
this.element.className = 'avocado-stage'; this.element.className = 'avocado-stage';
@ -58,6 +59,8 @@ export class Stage extends decorate(Container) {
this.element.appendChild(this.ui); this.element.appendChild(this.ui);
this.element.tabIndex = 0; this.element.tabIndex = 0;
this.on('cameraChanged', this.onCameraChanged, this); this.on('cameraChanged', this.onCameraChanged, this);
// Set scale.
this.scale = visibleScale;
} }
addToDom(parent) { addToDom(parent) {