|
|
@ -57,7 +57,12 @@ class Canvas { |
|
|
|
if (this.options.autoResize === true) { |
|
|
|
// automatically adapt to a changing size of the browser.
|
|
|
|
this._cleanUp(); |
|
|
|
this.resizeTimer = setInterval(() => {this.setSize(); this.body.emitter.emit("_requestRedraw");}, 1000); |
|
|
|
this.resizeTimer = setInterval(() => { |
|
|
|
let changed = this.setSize(); |
|
|
|
if (changed === true) { |
|
|
|
this.body.emitter.emit("_requestRedraw"); |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
this.resizeFunction = this._onResize.bind(this); |
|
|
|
util.addEventListener(window,'resize',this.resizeFunction); |
|
|
|
} |
|
|
@ -228,6 +233,8 @@ class Canvas { |
|
|
|
if (emitEvent === true) { |
|
|
|
this.body.emitter.emit('resize', {width:this.frame.canvas.width / this.pixelRatio, height:this.frame.canvas.height / this.pixelRatio, oldWidth: oldWidth / this.pixelRatio, oldHeight: oldHeight / this.pixelRatio}); |
|
|
|
} |
|
|
|
|
|
|
|
return emitEvent; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|