sdfsdfs
This commit is contained in:
149
node_modules/pixi.js/lib/app/Application.d.ts
generated
vendored
Normal file
149
node_modules/pixi.js/lib/app/Application.d.ts
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
import { Container } from '../scene/container/Container';
|
||||
import type { Rectangle } from '../maths/shapes/Rectangle';
|
||||
import type { AutoDetectOptions } from '../rendering/renderers/autoDetectRenderer';
|
||||
import type { RendererDestroyOptions } from '../rendering/renderers/shared/system/AbstractRenderer';
|
||||
import type { Renderer } from '../rendering/renderers/types';
|
||||
import type { DestroyOptions } from '../scene/container/destroyTypes';
|
||||
/**
|
||||
* The app module provides a set of classes to use as a starting point when building applications.
|
||||
*
|
||||
* <aside>This module has a mixin for <code>TickerPlugin</code> and <code>ResizePlugin</code>.
|
||||
* These will need to be imported if you are managing your own renderer.</aside>
|
||||
*
|
||||
* ```js
|
||||
* import { Application } from 'pixi.js';
|
||||
*
|
||||
* const app = new Application();
|
||||
*
|
||||
* await app.init();
|
||||
*
|
||||
* // don't forget to add the canvas to the DOM
|
||||
* document.body.appendChild(app.canvas);
|
||||
* ```
|
||||
* @namespace app
|
||||
*/
|
||||
/**
|
||||
* Any plugin that's usable for Application should contain these methods.
|
||||
* @example
|
||||
* import { ApplicationPlugin } from 'pixi.js';
|
||||
*
|
||||
* const plugin: ApplicationPlugin = {
|
||||
* init: (options: Partial<ApplicationOptions>) =>
|
||||
* {
|
||||
* // handle init here, use app options if needed
|
||||
* },
|
||||
* destroy: () =>
|
||||
* {
|
||||
* // handle destruction code here
|
||||
* }
|
||||
* }
|
||||
* @memberof app
|
||||
* @see {@link app.ApplicationOptions}
|
||||
* @ignore
|
||||
*/
|
||||
export interface ApplicationPlugin {
|
||||
/**
|
||||
* Called when Application is constructed, scoped to Application instance.
|
||||
* Passes in `options` as the only argument, which are Application `init()` options.
|
||||
* @param {object} options - Application options.
|
||||
*/
|
||||
init(options: Partial<ApplicationOptions>): void;
|
||||
/** Called when destroying Application, scoped to Application instance. */
|
||||
destroy(): void;
|
||||
}
|
||||
/**
|
||||
* Application options supplied to the {@link app.Application#init} method.
|
||||
* @memberof app
|
||||
* @example
|
||||
* import { Application } from 'pixi.js';
|
||||
*
|
||||
* const app = new Application();
|
||||
*
|
||||
* await app.init({
|
||||
* autoStart: false,
|
||||
* resizeTo: window,
|
||||
* sharedTicker: true,
|
||||
* });
|
||||
*/
|
||||
export interface ApplicationOptions extends AutoDetectOptions, PixiMixins.ApplicationOptions {
|
||||
}
|
||||
export interface Application extends PixiMixins.Application {
|
||||
}
|
||||
/**
|
||||
* Convenience class to create a new PixiJS application.
|
||||
*
|
||||
* This class automatically creates the renderer, ticker and root container.
|
||||
* @example
|
||||
* import { Application, Sprite } from 'pixi.js';
|
||||
*
|
||||
* // Create the application
|
||||
* const app = new Application();
|
||||
*
|
||||
* await app.init({ width: 800, height: 600 });
|
||||
*
|
||||
* // Add the view to the DOM
|
||||
* document.body.appendChild(app.canvas);
|
||||
*
|
||||
* // ex, add display objects
|
||||
* app.stage.addChild(Sprite.from('something.png'));
|
||||
* @memberof app
|
||||
*/
|
||||
export declare class Application<R extends Renderer = Renderer> {
|
||||
/**
|
||||
* Collection of installed plugins.
|
||||
* @alias _plugins
|
||||
*/
|
||||
static _plugins: ApplicationPlugin[];
|
||||
/** The root display container that's rendered. */
|
||||
stage: Container;
|
||||
/**
|
||||
* WebGL renderer if available, otherwise CanvasRenderer.
|
||||
* @member {rendering.Renderer}
|
||||
*/
|
||||
renderer: R;
|
||||
/** Create new Application instance */
|
||||
constructor();
|
||||
/** @deprecated since 8.0.0 */
|
||||
constructor(options?: Partial<ApplicationOptions>);
|
||||
/**
|
||||
* @param options - The optional application and renderer parameters.
|
||||
*/
|
||||
init(options?: Partial<ApplicationOptions>): Promise<void>;
|
||||
/** Render the current stage. */
|
||||
render(): void;
|
||||
/**
|
||||
* Reference to the renderer's canvas element.
|
||||
* @readonly
|
||||
* @member {HTMLCanvasElement}
|
||||
*/
|
||||
get canvas(): R['canvas'];
|
||||
/**
|
||||
* Reference to the renderer's canvas element.
|
||||
* @member {HTMLCanvasElement}
|
||||
* @deprecated since 8.0.0
|
||||
*/
|
||||
get view(): R['canvas'];
|
||||
/**
|
||||
* Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
|
||||
* @readonly
|
||||
*/
|
||||
get screen(): Rectangle;
|
||||
/**
|
||||
* Destroys the application and all of its resources.
|
||||
* @param {object|boolean}[rendererDestroyOptions=false] - The options for destroying the renderer.
|
||||
* @param {boolean}[rendererDestroyOptions.removeView=false] - Removes the Canvas element from the DOM.
|
||||
* @param {object|boolean} [options=false] - The options for destroying the stage.
|
||||
* @param {boolean} [options.children=false] - If set to true, all the children will have their destroy method
|
||||
* called as well. `options` will be passed on to those calls.
|
||||
* @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the texture of the child sprite.
|
||||
* @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the texture source of the child sprite.
|
||||
* @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the context of the child graphics.
|
||||
*/
|
||||
destroy(rendererDestroyOptions?: RendererDestroyOptions, options?: DestroyOptions): void;
|
||||
}
|
96
node_modules/pixi.js/lib/app/Application.js
generated
vendored
Normal file
96
node_modules/pixi.js/lib/app/Application.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../extensions/Extensions.js');
|
||||
var autoDetectRenderer = require('../rendering/renderers/autoDetectRenderer.js');
|
||||
var Container = require('../scene/container/Container.js');
|
||||
var globalHooks = require('../utils/global/globalHooks.js');
|
||||
var deprecation = require('../utils/logging/deprecation.js');
|
||||
|
||||
"use strict";
|
||||
const _Application = class _Application {
|
||||
/** @ignore */
|
||||
constructor(...args) {
|
||||
/** The root display container that's rendered. */
|
||||
this.stage = new Container.Container();
|
||||
if (args[0] !== void 0) {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "Application constructor options are deprecated, please use Application.init() instead.");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param options - The optional application and renderer parameters.
|
||||
*/
|
||||
async init(options) {
|
||||
options = { ...options };
|
||||
this.renderer = await autoDetectRenderer.autoDetectRenderer(options);
|
||||
_Application._plugins.forEach((plugin) => {
|
||||
plugin.init.call(this, options);
|
||||
});
|
||||
}
|
||||
/** Render the current stage. */
|
||||
render() {
|
||||
this.renderer.render({ container: this.stage });
|
||||
}
|
||||
/**
|
||||
* Reference to the renderer's canvas element.
|
||||
* @readonly
|
||||
* @member {HTMLCanvasElement}
|
||||
*/
|
||||
get canvas() {
|
||||
return this.renderer.canvas;
|
||||
}
|
||||
/**
|
||||
* Reference to the renderer's canvas element.
|
||||
* @member {HTMLCanvasElement}
|
||||
* @deprecated since 8.0.0
|
||||
*/
|
||||
get view() {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "Application.view is deprecated, please use Application.canvas instead.");
|
||||
return this.renderer.canvas;
|
||||
}
|
||||
/**
|
||||
* Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
|
||||
* @readonly
|
||||
*/
|
||||
get screen() {
|
||||
return this.renderer.screen;
|
||||
}
|
||||
/**
|
||||
* Destroys the application and all of its resources.
|
||||
* @param {object|boolean}[rendererDestroyOptions=false] - The options for destroying the renderer.
|
||||
* @param {boolean}[rendererDestroyOptions.removeView=false] - Removes the Canvas element from the DOM.
|
||||
* @param {object|boolean} [options=false] - The options for destroying the stage.
|
||||
* @param {boolean} [options.children=false] - If set to true, all the children will have their destroy method
|
||||
* called as well. `options` will be passed on to those calls.
|
||||
* @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the texture of the child sprite.
|
||||
* @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the texture source of the child sprite.
|
||||
* @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the context of the child graphics.
|
||||
*/
|
||||
destroy(rendererDestroyOptions = false, options = false) {
|
||||
const plugins = _Application._plugins.slice(0);
|
||||
plugins.reverse();
|
||||
plugins.forEach((plugin) => {
|
||||
plugin.destroy.call(this);
|
||||
});
|
||||
this.stage.destroy(options);
|
||||
this.stage = null;
|
||||
this.renderer.destroy(rendererDestroyOptions);
|
||||
this.renderer = null;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Collection of installed plugins.
|
||||
* @alias _plugins
|
||||
*/
|
||||
_Application._plugins = [];
|
||||
let Application = _Application;
|
||||
Extensions.extensions.handleByList(Extensions.ExtensionType.Application, Application._plugins);
|
||||
Extensions.extensions.add(globalHooks.ApplicationInitHook);
|
||||
|
||||
exports.Application = Application;
|
||||
//# sourceMappingURL=Application.js.map
|
1
node_modules/pixi.js/lib/app/Application.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/Application.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
94
node_modules/pixi.js/lib/app/Application.mjs
generated
vendored
Normal file
94
node_modules/pixi.js/lib/app/Application.mjs
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
import { extensions, ExtensionType } from '../extensions/Extensions.mjs';
|
||||
import { autoDetectRenderer } from '../rendering/renderers/autoDetectRenderer.mjs';
|
||||
import { Container } from '../scene/container/Container.mjs';
|
||||
import { ApplicationInitHook } from '../utils/global/globalHooks.mjs';
|
||||
import { deprecation, v8_0_0 } from '../utils/logging/deprecation.mjs';
|
||||
|
||||
"use strict";
|
||||
const _Application = class _Application {
|
||||
/** @ignore */
|
||||
constructor(...args) {
|
||||
/** The root display container that's rendered. */
|
||||
this.stage = new Container();
|
||||
if (args[0] !== void 0) {
|
||||
deprecation(v8_0_0, "Application constructor options are deprecated, please use Application.init() instead.");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param options - The optional application and renderer parameters.
|
||||
*/
|
||||
async init(options) {
|
||||
options = { ...options };
|
||||
this.renderer = await autoDetectRenderer(options);
|
||||
_Application._plugins.forEach((plugin) => {
|
||||
plugin.init.call(this, options);
|
||||
});
|
||||
}
|
||||
/** Render the current stage. */
|
||||
render() {
|
||||
this.renderer.render({ container: this.stage });
|
||||
}
|
||||
/**
|
||||
* Reference to the renderer's canvas element.
|
||||
* @readonly
|
||||
* @member {HTMLCanvasElement}
|
||||
*/
|
||||
get canvas() {
|
||||
return this.renderer.canvas;
|
||||
}
|
||||
/**
|
||||
* Reference to the renderer's canvas element.
|
||||
* @member {HTMLCanvasElement}
|
||||
* @deprecated since 8.0.0
|
||||
*/
|
||||
get view() {
|
||||
deprecation(v8_0_0, "Application.view is deprecated, please use Application.canvas instead.");
|
||||
return this.renderer.canvas;
|
||||
}
|
||||
/**
|
||||
* Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
|
||||
* @readonly
|
||||
*/
|
||||
get screen() {
|
||||
return this.renderer.screen;
|
||||
}
|
||||
/**
|
||||
* Destroys the application and all of its resources.
|
||||
* @param {object|boolean}[rendererDestroyOptions=false] - The options for destroying the renderer.
|
||||
* @param {boolean}[rendererDestroyOptions.removeView=false] - Removes the Canvas element from the DOM.
|
||||
* @param {object|boolean} [options=false] - The options for destroying the stage.
|
||||
* @param {boolean} [options.children=false] - If set to true, all the children will have their destroy method
|
||||
* called as well. `options` will be passed on to those calls.
|
||||
* @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the texture of the child sprite.
|
||||
* @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the texture source of the child sprite.
|
||||
* @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.
|
||||
* If options.children is set to true,
|
||||
* it should destroy the context of the child graphics.
|
||||
*/
|
||||
destroy(rendererDestroyOptions = false, options = false) {
|
||||
const plugins = _Application._plugins.slice(0);
|
||||
plugins.reverse();
|
||||
plugins.forEach((plugin) => {
|
||||
plugin.destroy.call(this);
|
||||
});
|
||||
this.stage.destroy(options);
|
||||
this.stage = null;
|
||||
this.renderer.destroy(rendererDestroyOptions);
|
||||
this.renderer = null;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Collection of installed plugins.
|
||||
* @alias _plugins
|
||||
*/
|
||||
_Application._plugins = [];
|
||||
let Application = _Application;
|
||||
extensions.handleByList(ExtensionType.Application, Application._plugins);
|
||||
extensions.add(ApplicationInitHook);
|
||||
|
||||
export { Application };
|
||||
//# sourceMappingURL=Application.mjs.map
|
1
node_modules/pixi.js/lib/app/Application.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/Application.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
27
node_modules/pixi.js/lib/app/ApplicationMixins.d.ts
generated
vendored
Normal file
27
node_modules/pixi.js/lib/app/ApplicationMixins.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { Ticker } from '../ticker/Ticker';
|
||||
import type { ResizePluginOptions } from './ResizePlugin';
|
||||
import type { TickerPluginOptions } from './TickerPlugin';
|
||||
|
||||
declare global
|
||||
{
|
||||
namespace PixiMixins
|
||||
{
|
||||
// Extend the Application interface with resize and ticker functionalities
|
||||
interface Application
|
||||
{
|
||||
resizeTo: Window | HTMLElement;
|
||||
resize(): void;
|
||||
queueResize(): void;
|
||||
cancelResize(): void;
|
||||
|
||||
ticker: Ticker;
|
||||
stop(): void;
|
||||
start(): void;
|
||||
}
|
||||
|
||||
// Combine ResizePluginOptions and TickerPluginOptions into ApplicationOptions
|
||||
interface ApplicationOptions extends ResizePluginOptions, TickerPluginOptions {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
55
node_modules/pixi.js/lib/app/ResizePlugin.d.ts
generated
vendored
Normal file
55
node_modules/pixi.js/lib/app/ResizePlugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { ExtensionMetadata } from '../extensions/Extensions';
|
||||
import type { Renderer } from '../rendering/renderers/types';
|
||||
type ResizeableRenderer = Pick<Renderer, 'resize'>;
|
||||
/**
|
||||
* Application options for the {@link app.ResizePlugin}.
|
||||
* @memberof app
|
||||
* @property {Window|HTMLElement} [resizeTo=window] - Element to automatically resize the renderer to.
|
||||
*/
|
||||
export interface ResizePluginOptions {
|
||||
/**
|
||||
* Element to automatically resize the renderer to.
|
||||
* @memberof app.ApplicationOptions
|
||||
*/
|
||||
resizeTo?: Window | HTMLElement;
|
||||
}
|
||||
/**
|
||||
* Middleware for Application's resize functionality.
|
||||
*
|
||||
* Adds the following methods to {@link app.Application}:
|
||||
* * {@link app.Application#resizeTo}
|
||||
* * {@link app.Application#resize}
|
||||
* * {@link app.Application#queueResize}
|
||||
* * {@link app.Application#cancelResize}
|
||||
* @example
|
||||
* import { extensions, ResizePlugin } from 'pixi.js';
|
||||
*
|
||||
* extensions.add(ResizePlugin);
|
||||
* @memberof app
|
||||
*/
|
||||
export declare class ResizePlugin {
|
||||
/** @ignore */
|
||||
static extension: ExtensionMetadata;
|
||||
static resizeTo: Window | HTMLElement;
|
||||
static resize: () => void;
|
||||
static renderer: ResizeableRenderer;
|
||||
static queueResize: () => void;
|
||||
static render: () => void;
|
||||
private static _resizeId;
|
||||
private static _resizeTo;
|
||||
private static _cancelResize;
|
||||
/**
|
||||
* Initialize the plugin with scope of application instance
|
||||
* @static
|
||||
* @private
|
||||
* @param {object} [options] - See application options
|
||||
*/
|
||||
static init(options: ResizePluginOptions): void;
|
||||
/**
|
||||
* Clean up the ticker, scoped to application
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
static destroy(): void;
|
||||
}
|
||||
export {};
|
91
node_modules/pixi.js/lib/app/ResizePlugin.js
generated
vendored
Normal file
91
node_modules/pixi.js/lib/app/ResizePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../extensions/Extensions.js');
|
||||
|
||||
"use strict";
|
||||
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",
|
||||
/**
|
||||
* The HTML element or window to automatically resize the
|
||||
* renderer's view element to match width and height.
|
||||
* @member {Window|HTMLElement}
|
||||
* @name resizeTo
|
||||
* @memberof app.Application#
|
||||
*/
|
||||
{
|
||||
set(dom) {
|
||||
globalThis.removeEventListener("resize", this.queueResize);
|
||||
this._resizeTo = dom;
|
||||
if (dom) {
|
||||
globalThis.addEventListener("resize", this.queueResize);
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this._resizeTo;
|
||||
}
|
||||
}
|
||||
);
|
||||
this.queueResize = () => {
|
||||
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 {
|
||||
const { clientWidth, clientHeight } = this._resizeTo;
|
||||
width = clientWidth;
|
||||
height = clientHeight;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
ResizePlugin.extension = Extensions.ExtensionType.Application;
|
||||
|
||||
exports.ResizePlugin = ResizePlugin;
|
||||
//# sourceMappingURL=ResizePlugin.js.map
|
1
node_modules/pixi.js/lib/app/ResizePlugin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/ResizePlugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
node_modules/pixi.js/lib/app/ResizePlugin.mjs
generated
vendored
Normal file
89
node_modules/pixi.js/lib/app/ResizePlugin.mjs
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import { ExtensionType } from '../extensions/Extensions.mjs';
|
||||
|
||||
"use strict";
|
||||
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",
|
||||
/**
|
||||
* The HTML element or window to automatically resize the
|
||||
* renderer's view element to match width and height.
|
||||
* @member {Window|HTMLElement}
|
||||
* @name resizeTo
|
||||
* @memberof app.Application#
|
||||
*/
|
||||
{
|
||||
set(dom) {
|
||||
globalThis.removeEventListener("resize", this.queueResize);
|
||||
this._resizeTo = dom;
|
||||
if (dom) {
|
||||
globalThis.addEventListener("resize", this.queueResize);
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this._resizeTo;
|
||||
}
|
||||
}
|
||||
);
|
||||
this.queueResize = () => {
|
||||
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 {
|
||||
const { clientWidth, clientHeight } = this._resizeTo;
|
||||
width = clientWidth;
|
||||
height = clientHeight;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
ResizePlugin.extension = ExtensionType.Application;
|
||||
|
||||
export { ResizePlugin };
|
||||
//# sourceMappingURL=ResizePlugin.mjs.map
|
1
node_modules/pixi.js/lib/app/ResizePlugin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/ResizePlugin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
node_modules/pixi.js/lib/app/TickerPlugin.d.ts
generated
vendored
Normal file
64
node_modules/pixi.js/lib/app/TickerPlugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import { Ticker } from '../ticker/Ticker';
|
||||
import type { ExtensionMetadata } from '../extensions/Extensions';
|
||||
/**
|
||||
* Application options for the {@link app.TickerPlugin}.
|
||||
* @memberof app
|
||||
* @property {boolean} [autoStart=true] - Automatically starts the rendering after the construction.
|
||||
* **Note**: Setting this parameter to `false` does NOT stop the shared ticker even if you set
|
||||
* `options.sharedTicker` to `true` in case that it is already started. Stop it by your own.
|
||||
* @property {boolean} [sharedTicker=false] - Set`true` to use `Ticker.shared`, `false` to create new ticker.
|
||||
* If set to `false`, you cannot register a handler to occur before anything that runs on the shared ticker.
|
||||
* The system ticker will always run before both the shared ticker and the app ticker.
|
||||
*/
|
||||
export interface TickerPluginOptions {
|
||||
/**
|
||||
* Automatically starts the rendering after the construction.
|
||||
* **Note**: Setting this parameter to `false` does NOT stop the shared ticker even if you set
|
||||
* `options.sharedTicker` to `true` in case that it is already started. Stop it by your own.
|
||||
* @memberof app.ApplicationOptions
|
||||
* @default true
|
||||
*/
|
||||
autoStart?: boolean;
|
||||
/**
|
||||
* Set`true` to use `Ticker.shared`, `false` to create new ticker.
|
||||
* If set to `false`, you cannot register a handler to occur before anything that runs on the shared ticker.
|
||||
* The system ticker will always run before both the shared ticker and the app ticker.
|
||||
* @memberof app.ApplicationOptions
|
||||
* @default false
|
||||
*/
|
||||
sharedTicker?: boolean;
|
||||
}
|
||||
/**
|
||||
* Middleware for Application's {@link ticker.Ticker} functionality.
|
||||
*
|
||||
* Adds the following methods to {@link app.Application}:
|
||||
* * {@link app.Application#start}
|
||||
* * {@link app.Application#stop}
|
||||
* * {@link app.Application#ticker}
|
||||
* @example
|
||||
* import { extensions, TickerPlugin } from 'pixi.js';
|
||||
*
|
||||
* extensions.add(TickerPlugin);
|
||||
* @memberof app
|
||||
*/
|
||||
export declare class TickerPlugin {
|
||||
/** @ignore */
|
||||
static extension: ExtensionMetadata;
|
||||
static start: () => void;
|
||||
static stop: () => void;
|
||||
private static _ticker;
|
||||
static ticker: Ticker;
|
||||
/**
|
||||
* Initialize the plugin with scope of application instance
|
||||
* @static
|
||||
* @private
|
||||
* @param {object} [options] - See application options
|
||||
*/
|
||||
static init(options?: PixiMixins.ApplicationOptions): void;
|
||||
/**
|
||||
* Clean up the ticker, scoped to application.
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
static destroy(): void;
|
||||
}
|
67
node_modules/pixi.js/lib/app/TickerPlugin.js
generated
vendored
Normal file
67
node_modules/pixi.js/lib/app/TickerPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../extensions/Extensions.js');
|
||||
var _const = require('../ticker/const.js');
|
||||
var Ticker = require('../ticker/Ticker.js');
|
||||
|
||||
"use strict";
|
||||
class TickerPlugin {
|
||||
/**
|
||||
* Initialize the plugin with scope of application instance
|
||||
* @static
|
||||
* @private
|
||||
* @param {object} [options] - See application options
|
||||
*/
|
||||
static init(options) {
|
||||
options = Object.assign({
|
||||
autoStart: true,
|
||||
sharedTicker: false
|
||||
}, options);
|
||||
Object.defineProperty(
|
||||
this,
|
||||
"ticker",
|
||||
{
|
||||
set(ticker) {
|
||||
if (this._ticker) {
|
||||
this._ticker.remove(this.render, this);
|
||||
}
|
||||
this._ticker = ticker;
|
||||
if (ticker) {
|
||||
ticker.add(this.render, this, _const.UPDATE_PRIORITY.LOW);
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this._ticker;
|
||||
}
|
||||
}
|
||||
);
|
||||
this.stop = () => {
|
||||
this._ticker.stop();
|
||||
};
|
||||
this.start = () => {
|
||||
this._ticker.start();
|
||||
};
|
||||
this._ticker = null;
|
||||
this.ticker = options.sharedTicker ? Ticker.Ticker.shared : new Ticker.Ticker();
|
||||
if (options.autoStart) {
|
||||
this.start();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Clean up the ticker, scoped to application.
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
static destroy() {
|
||||
if (this._ticker) {
|
||||
const oldTicker = this._ticker;
|
||||
this.ticker = null;
|
||||
oldTicker.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
TickerPlugin.extension = Extensions.ExtensionType.Application;
|
||||
|
||||
exports.TickerPlugin = TickerPlugin;
|
||||
//# sourceMappingURL=TickerPlugin.js.map
|
1
node_modules/pixi.js/lib/app/TickerPlugin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/TickerPlugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
65
node_modules/pixi.js/lib/app/TickerPlugin.mjs
generated
vendored
Normal file
65
node_modules/pixi.js/lib/app/TickerPlugin.mjs
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { ExtensionType } from '../extensions/Extensions.mjs';
|
||||
import { UPDATE_PRIORITY } from '../ticker/const.mjs';
|
||||
import { Ticker } from '../ticker/Ticker.mjs';
|
||||
|
||||
"use strict";
|
||||
class TickerPlugin {
|
||||
/**
|
||||
* Initialize the plugin with scope of application instance
|
||||
* @static
|
||||
* @private
|
||||
* @param {object} [options] - See application options
|
||||
*/
|
||||
static init(options) {
|
||||
options = Object.assign({
|
||||
autoStart: true,
|
||||
sharedTicker: false
|
||||
}, options);
|
||||
Object.defineProperty(
|
||||
this,
|
||||
"ticker",
|
||||
{
|
||||
set(ticker) {
|
||||
if (this._ticker) {
|
||||
this._ticker.remove(this.render, this);
|
||||
}
|
||||
this._ticker = ticker;
|
||||
if (ticker) {
|
||||
ticker.add(this.render, this, UPDATE_PRIORITY.LOW);
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this._ticker;
|
||||
}
|
||||
}
|
||||
);
|
||||
this.stop = () => {
|
||||
this._ticker.stop();
|
||||
};
|
||||
this.start = () => {
|
||||
this._ticker.start();
|
||||
};
|
||||
this._ticker = null;
|
||||
this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();
|
||||
if (options.autoStart) {
|
||||
this.start();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Clean up the ticker, scoped to application.
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
static destroy() {
|
||||
if (this._ticker) {
|
||||
const oldTicker = this._ticker;
|
||||
this.ticker = null;
|
||||
oldTicker.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
TickerPlugin.extension = ExtensionType.Application;
|
||||
|
||||
export { TickerPlugin };
|
||||
//# sourceMappingURL=TickerPlugin.mjs.map
|
1
node_modules/pixi.js/lib/app/TickerPlugin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/TickerPlugin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/pixi.js/lib/app/index.d.ts
generated
vendored
Normal file
3
node_modules/pixi.js/lib/app/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './Application';
|
||||
export * from './ResizePlugin';
|
||||
export * from './TickerPlugin';
|
12
node_modules/pixi.js/lib/app/index.js
generated
vendored
Normal file
12
node_modules/pixi.js/lib/app/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var Application = require('./Application.js');
|
||||
var ResizePlugin = require('./ResizePlugin.js');
|
||||
var TickerPlugin = require('./TickerPlugin.js');
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.Application = Application.Application;
|
||||
exports.ResizePlugin = ResizePlugin.ResizePlugin;
|
||||
exports.TickerPlugin = TickerPlugin.TickerPlugin;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/pixi.js/lib/app/index.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
6
node_modules/pixi.js/lib/app/index.mjs
generated
vendored
Normal file
6
node_modules/pixi.js/lib/app/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { Application } from './Application.mjs';
|
||||
export { ResizePlugin } from './ResizePlugin.mjs';
|
||||
export { TickerPlugin } from './TickerPlugin.mjs';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=index.mjs.map
|
1
node_modules/pixi.js/lib/app/index.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
1
node_modules/pixi.js/lib/app/init.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/init.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
10
node_modules/pixi.js/lib/app/init.js
generated
vendored
Normal file
10
node_modules/pixi.js/lib/app/init.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../extensions/Extensions.js');
|
||||
var ResizePlugin = require('./ResizePlugin.js');
|
||||
var TickerPlugin = require('./TickerPlugin.js');
|
||||
|
||||
"use strict";
|
||||
Extensions.extensions.add(ResizePlugin.ResizePlugin);
|
||||
Extensions.extensions.add(TickerPlugin.TickerPlugin);
|
||||
//# sourceMappingURL=init.js.map
|
1
node_modules/pixi.js/lib/app/init.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/init.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.js","sources":["../../src/app/init.ts"],"sourcesContent":["import { extensions } from '../extensions/Extensions';\nimport { ResizePlugin } from './ResizePlugin';\nimport { TickerPlugin } from './TickerPlugin';\n\nextensions.add(ResizePlugin);\nextensions.add(TickerPlugin);\n"],"names":["extensions","ResizePlugin","TickerPlugin"],"mappings":";;;;;;;AAIAA,qBAAA,CAAW,IAAIC,yBAAY,CAAA,CAAA;AAC3BD,qBAAA,CAAW,IAAIE,yBAAY,CAAA;;"}
|
8
node_modules/pixi.js/lib/app/init.mjs
generated
vendored
Normal file
8
node_modules/pixi.js/lib/app/init.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { extensions } from '../extensions/Extensions.mjs';
|
||||
import { ResizePlugin } from './ResizePlugin.mjs';
|
||||
import { TickerPlugin } from './TickerPlugin.mjs';
|
||||
|
||||
"use strict";
|
||||
extensions.add(ResizePlugin);
|
||||
extensions.add(TickerPlugin);
|
||||
//# sourceMappingURL=init.mjs.map
|
1
node_modules/pixi.js/lib/app/init.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/app/init.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.mjs","sources":["../../src/app/init.ts"],"sourcesContent":["import { extensions } from '../extensions/Extensions';\nimport { ResizePlugin } from './ResizePlugin';\nimport { TickerPlugin } from './TickerPlugin';\n\nextensions.add(ResizePlugin);\nextensions.add(TickerPlugin);\n"],"names":[],"mappings":";;;;;AAIA,UAAA,CAAW,IAAI,YAAY,CAAA,CAAA;AAC3B,UAAA,CAAW,IAAI,YAAY,CAAA"}
|
Reference in New Issue
Block a user