refactor: stage ctor
This commit is contained in:
parent
eaf031257e
commit
5b6e399c30
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user