@pixi/app
Advanced tools
Comparing version 7.2.4 to 7.3.0-rc
@@ -1,45 +0,57 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var core = require('@pixi/core'); | ||
var display = require('@pixi/display'); | ||
const _Application = class { | ||
"use strict"; | ||
var core = require("@pixi/core"), display = require("@pixi/display"); | ||
const _Application = class _Application2 { | ||
/** | ||
* @param options - The optional application and renderer parameters. | ||
*/ | ||
constructor(options) { | ||
this.stage = new display.Container(); | ||
options = Object.assign({ | ||
forceCanvas: false | ||
}, options); | ||
this.renderer = core.autoDetectRenderer(options); | ||
_Application._plugins.forEach((plugin) => { | ||
this.stage = new display.Container(), options = Object.assign({ | ||
forceCanvas: !1 | ||
}, options), this.renderer = core.autoDetectRenderer(options), _Application2._plugins.forEach((plugin) => { | ||
plugin.init.call(this, options); | ||
}); | ||
} | ||
/** Render the current stage. */ | ||
render() { | ||
this.renderer.render(this.stage); | ||
} | ||
/** | ||
* Reference to the renderer's canvas element. | ||
* @member {PIXI.ICanvas} | ||
* @readonly | ||
*/ | ||
get view() { | ||
return this.renderer.view; | ||
return this.renderer?.view; | ||
} | ||
/** | ||
* Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. | ||
* @member {PIXI.Rectangle} | ||
* @readonly | ||
*/ | ||
get screen() { | ||
return this.renderer.screen; | ||
return this.renderer?.screen; | ||
} | ||
/** | ||
* Destroy and don't use after this. | ||
* @param {boolean} [removeView=false] - Automatically remove canvas from DOM. | ||
* @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options | ||
* have been set to that value | ||
* @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy | ||
* method called as well. 'stageOptions' will be passed on to those calls. | ||
* @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set | ||
* to true. Should it destroy the texture of the child sprite | ||
* @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set | ||
* to true. Should it destroy the base texture of the child sprite | ||
*/ | ||
destroy(removeView, stageOptions) { | ||
const plugins = _Application._plugins.slice(0); | ||
plugins.reverse(); | ||
plugins.forEach((plugin) => { | ||
const plugins = _Application2._plugins.slice(0); | ||
plugins.reverse(), plugins.forEach((plugin) => { | ||
plugin.destroy.call(this); | ||
}); | ||
this.stage.destroy(stageOptions); | ||
this.stage = null; | ||
this.renderer.destroy(removeView); | ||
this.renderer = null; | ||
}), this.stage.destroy(stageOptions), this.stage = null, this.renderer.destroy(removeView), this.renderer = null; | ||
} | ||
}; | ||
_Application._plugins = []; | ||
let Application = _Application; | ||
Application._plugins = []; | ||
core.extensions.handleByList(core.ExtensionType.Application, Application._plugins); | ||
exports.Application = Application; | ||
//# sourceMappingURL=Application.js.map |
@@ -1,12 +0,5 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var Application = require('./Application.js'); | ||
var ResizePlugin = require('./ResizePlugin.js'); | ||
"use strict"; | ||
var Application = require("./Application.js"), ResizePlugin = require("./ResizePlugin.js"); | ||
exports.Application = Application.Application; | ||
exports.ResizePlugin = ResizePlugin.ResizePlugin; | ||
//# sourceMappingURL=index.js.map |
@@ -1,64 +0,54 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var core = require('@pixi/core'); | ||
"use strict"; | ||
var core = require("@pixi/core"); | ||
class ResizePlugin { | ||
/** | ||
* Initialize the plugin with scope of application instance | ||
* @static | ||
* @private | ||
* @param {object} [options] - See application options | ||
*/ | ||
static init(options) { | ||
Object.defineProperty(this, "resizeTo", { | ||
set(dom) { | ||
globalThis.removeEventListener("resize", this.queueResize); | ||
this._resizeTo = dom; | ||
if (dom) { | ||
globalThis.addEventListener("resize", this.queueResize); | ||
this.resize(); | ||
Object.defineProperty( | ||
this, | ||
"resizeTo", | ||
/** | ||
* The HTML element or window to automatically resize the | ||
* renderer's view element to match width and height. | ||
* @member {Window|HTMLElement} | ||
* @name resizeTo | ||
* @memberof PIXI.Application# | ||
*/ | ||
{ | ||
set(dom) { | ||
globalThis.removeEventListener("resize", this.queueResize), this._resizeTo = dom, dom && (globalThis.addEventListener("resize", this.queueResize), this.resize()); | ||
}, | ||
get() { | ||
return this._resizeTo; | ||
} | ||
}, | ||
get() { | ||
return this._resizeTo; | ||
} | ||
}); | ||
this.queueResize = () => { | ||
if (!this._resizeTo) { | ||
), this.queueResize = () => { | ||
this._resizeTo && (this.cancelResize(), this._resizeId = requestAnimationFrame(() => this.resize())); | ||
}, this.cancelResize = () => { | ||
this._resizeId && (cancelAnimationFrame(this._resizeId), this._resizeId = null); | ||
}, this.resize = () => { | ||
if (!this._resizeTo) | ||
return; | ||
} | ||
this.cancelResize(); | ||
this._resizeId = requestAnimationFrame(() => this.resize()); | ||
}; | ||
this.cancelResize = () => { | ||
if (this._resizeId) { | ||
cancelAnimationFrame(this._resizeId); | ||
this._resizeId = null; | ||
} | ||
}; | ||
this.resize = () => { | ||
if (!this._resizeTo) { | ||
return; | ||
} | ||
this.cancelResize(); | ||
let width; | ||
let height; | ||
if (this._resizeTo === globalThis.window) { | ||
width = globalThis.innerWidth; | ||
height = globalThis.innerHeight; | ||
} else { | ||
let width, height; | ||
if (this._resizeTo === globalThis.window) | ||
width = globalThis.innerWidth, height = globalThis.innerHeight; | ||
else { | ||
const { clientWidth, clientHeight } = this._resizeTo; | ||
width = clientWidth; | ||
height = clientHeight; | ||
width = clientWidth, height = clientHeight; | ||
} | ||
this.renderer.resize(width, height); | ||
this.render(); | ||
}; | ||
this._resizeId = null; | ||
this._resizeTo = null; | ||
this.resizeTo = options.resizeTo || null; | ||
this.renderer.resize(width, height), this.render(); | ||
}, this._resizeId = null, this._resizeTo = null, this.resizeTo = options.resizeTo || null; | ||
} | ||
/** | ||
* Clean up the ticker, scoped to application | ||
* @static | ||
* @private | ||
*/ | ||
static destroy() { | ||
globalThis.removeEventListener("resize", this.queueResize); | ||
this.cancelResize(); | ||
this.cancelResize = null; | ||
this.queueResize = null; | ||
this.resizeTo = null; | ||
this.resize = null; | ||
globalThis.removeEventListener("resize", this.queueResize), this.cancelResize(), this.cancelResize = null, this.queueResize = null, this.resizeTo = null, this.resize = null; | ||
} | ||
@@ -68,4 +58,3 @@ } | ||
core.extensions.add(ResizePlugin); | ||
exports.ResizePlugin = ResizePlugin; | ||
//# sourceMappingURL=ResizePlugin.js.map |
{ | ||
"name": "@pixi/app", | ||
"version": "7.2.4", | ||
"version": "7.3.0-rc", | ||
"main": "lib/index.js", | ||
@@ -39,5 +39,5 @@ "module": "lib/index.mjs", | ||
"peerDependencies": { | ||
"@pixi/core": "7.2.4", | ||
"@pixi/display": "7.2.4" | ||
"@pixi/core": "7.3.0-rc", | ||
"@pixi/display": "7.3.0-rc" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40185
392
1