Fixed resize fullscreen bug.
This commit is contained in:
+14
-1
@@ -137,7 +137,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
this.graphql = graphql
|
||||
if (fullScreen || autoResize) {
|
||||
console.log('App is in fullScreen mode or autoResize mode')
|
||||
const resizeDebounced = debounce(event => this.resize(event), 50)
|
||||
const resizeDebounced = debounce(event => this.resizeApp(event), 50)
|
||||
window.addEventListener('resize', resizeDebounced)
|
||||
document.body.addEventListener('orientationchange', this.checkOrientation.bind(this))
|
||||
}
|
||||
@@ -312,6 +312,19 @@ export default class PIXIApp extends PIXI.Application {
|
||||
* @return {PIXIApp} - Returns the PIXIApp for chaining.
|
||||
*/
|
||||
resize(event, { width = window.innerWidth, height = window.innerHeight } = {}) {
|
||||
return this.resizeApp(event, { width, height })
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the renderer to fit into the window or given width and height.
|
||||
*
|
||||
* @param {object} [event] - The event.
|
||||
* @param {object=} [opts={}] - The event.
|
||||
* @param {number} [opts.width=window.innerWidth] - The width of the app to resize to.
|
||||
* @param {number} [opts.height=window.innerHeight] - The height of the app to resize to.
|
||||
* @return {PIXIApp} - Returns the PIXIApp for chaining.
|
||||
*/
|
||||
resizeApp(event, { width = window.innerWidth, height = window.innerHeight } = {}) {
|
||||
this.width = width
|
||||
this.height = height
|
||||
this.expandRenderer()
|
||||
|
||||
Reference in New Issue
Block a user