zimporter-html 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/ParticleConverter.d.ts +26 -0
- package/dist/ParticleConverter.d.ts.map +1 -0
- package/dist/ParticleConverter.js +129 -0
- package/dist/ParticleConverter.js.map +1 -0
- package/dist/SceneData.d.ts +189 -0
- package/dist/SceneData.d.ts.map +1 -0
- package/dist/SceneData.js +16 -0
- package/dist/SceneData.js.map +1 -0
- package/dist/ZButton.d.ts +37 -0
- package/dist/ZButton.d.ts.map +1 -0
- package/dist/ZButton.js +258 -0
- package/dist/ZButton.js.map +1 -0
- package/dist/ZContainer.d.ts +154 -0
- package/dist/ZContainer.d.ts.map +1 -0
- package/dist/ZContainer.js +540 -0
- package/dist/ZContainer.js.map +1 -0
- package/dist/ZCuePointsManager.d.ts +8 -0
- package/dist/ZCuePointsManager.d.ts.map +1 -0
- package/dist/ZCuePointsManager.js +26 -0
- package/dist/ZCuePointsManager.js.map +1 -0
- package/dist/ZNineSlice.d.ts +23 -0
- package/dist/ZNineSlice.d.ts.map +1 -0
- package/dist/ZNineSlice.js +72 -0
- package/dist/ZNineSlice.js.map +1 -0
- package/dist/ZPool.d.ts +16 -0
- package/dist/ZPool.d.ts.map +1 -0
- package/dist/ZPool.js +54 -0
- package/dist/ZPool.js.map +1 -0
- package/dist/ZResizeables.d.ts +8 -0
- package/dist/ZResizeables.d.ts.map +1 -0
- package/dist/ZResizeables.js +16 -0
- package/dist/ZResizeables.js.map +1 -0
- package/dist/ZScene.d.ts +82 -0
- package/dist/ZScene.d.ts.map +1 -0
- package/dist/ZScene.js +663 -0
- package/dist/ZScene.js.map +1 -0
- package/dist/ZSceneStack.d.ts +19 -0
- package/dist/ZSceneStack.d.ts.map +1 -0
- package/dist/ZSceneStack.js +47 -0
- package/dist/ZSceneStack.js.map +1 -0
- package/dist/ZScroll.d.ts +72 -0
- package/dist/ZScroll.d.ts.map +1 -0
- package/dist/ZScroll.js +276 -0
- package/dist/ZScroll.js.map +1 -0
- package/dist/ZSlider.d.ts +45 -0
- package/dist/ZSlider.d.ts.map +1 -0
- package/dist/ZSlider.js +176 -0
- package/dist/ZSlider.js.map +1 -0
- package/dist/ZSpine.d.ts +54 -0
- package/dist/ZSpine.d.ts.map +1 -0
- package/dist/ZSpine.js +166 -0
- package/dist/ZSpine.js.map +1 -0
- package/dist/ZState.d.ts +15 -0
- package/dist/ZState.d.ts.map +1 -0
- package/dist/ZState.js +50 -0
- package/dist/ZState.js.map +1 -0
- package/dist/ZTextInput.d.ts +24 -0
- package/dist/ZTextInput.d.ts.map +1 -0
- package/dist/ZTextInput.js +109 -0
- package/dist/ZTextInput.js.map +1 -0
- package/dist/ZTimeline.d.ts +30 -0
- package/dist/ZTimeline.d.ts.map +1 -0
- package/dist/ZTimeline.js +123 -0
- package/dist/ZTimeline.js.map +1 -0
- package/dist/ZToggle.d.ts +19 -0
- package/dist/ZToggle.d.ts.map +1 -0
- package/dist/ZToggle.js +56 -0
- package/dist/ZToggle.js.map +1 -0
- package/dist/ZUpdatables.d.ts +24 -0
- package/dist/ZUpdatables.d.ts.map +1 -0
- package/dist/ZUpdatables.js +50 -0
- package/dist/ZUpdatables.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/zimporter-html.min.js +2 -0
- package/dist/zimporter-html.min.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ZContainer } from './ZContainer';
|
|
2
|
+
/**
|
|
3
|
+
* HTML div–based nine-slice container.
|
|
4
|
+
*
|
|
5
|
+
* Wraps a CSS `border-image` div that stretches the edges/corners while
|
|
6
|
+
* keeping the slice cuts intact — equivalent to Phaser.NineSlice and
|
|
7
|
+
* PIXI.NineSlicePlane.
|
|
8
|
+
*
|
|
9
|
+
* ZNineSlice extends ZContainer so it participates directly in the
|
|
10
|
+
* resize map and scene graph. The inner div owns the CSS border-image;
|
|
11
|
+
* the outer ZContainer el carries the CSS transform (position/scale).
|
|
12
|
+
*/
|
|
13
|
+
export class ZNineSlice extends ZContainer {
|
|
14
|
+
innerDiv;
|
|
15
|
+
nsData;
|
|
16
|
+
constructor(data, orientation, assetBasePath) {
|
|
17
|
+
super();
|
|
18
|
+
this.nsData = data;
|
|
19
|
+
this.portrait = data.portrait;
|
|
20
|
+
this.landscape = data.landscape;
|
|
21
|
+
this.currentTransform = orientation === 'portrait' ? this.portrait : this.landscape;
|
|
22
|
+
// ── Inner div: carries the CSS border-image rendering ─────────────────
|
|
23
|
+
this.innerDiv = document.createElement('div');
|
|
24
|
+
this.innerDiv.style.position = 'absolute';
|
|
25
|
+
this.innerDiv.style.left = '0';
|
|
26
|
+
this.innerDiv.style.top = '0';
|
|
27
|
+
this.innerDiv.dataset.name = data.name;
|
|
28
|
+
const src = assetBasePath + (data.filePath ?? '');
|
|
29
|
+
const { top: t, right: r, bottom: b, left: l } = data;
|
|
30
|
+
if (src && t != null) {
|
|
31
|
+
// `fill` keyword keeps the centre of the source image visible.
|
|
32
|
+
this.innerDiv.style.borderImage =
|
|
33
|
+
`url(${src}) ${t} ${r} ${b} ${l} fill / ${t}px ${r}px ${b}px ${l}px`;
|
|
34
|
+
}
|
|
35
|
+
else if (src) {
|
|
36
|
+
this.innerDiv.style.backgroundImage = `url(${src})`;
|
|
37
|
+
this.innerDiv.style.backgroundSize = '100% 100%';
|
|
38
|
+
}
|
|
39
|
+
this.el.appendChild(this.innerDiv);
|
|
40
|
+
// Apply initial size from current orientation.
|
|
41
|
+
this._applySize();
|
|
42
|
+
}
|
|
43
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
44
|
+
// Overrides
|
|
45
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
46
|
+
applyTransform() {
|
|
47
|
+
super.applyTransform();
|
|
48
|
+
this._applySize();
|
|
49
|
+
}
|
|
50
|
+
resize(_width, _height, orientation) {
|
|
51
|
+
this.currentTransform = orientation === 'portrait' ? this.portrait : this.landscape;
|
|
52
|
+
this.applyTransform();
|
|
53
|
+
}
|
|
54
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
55
|
+
// Private helpers
|
|
56
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
57
|
+
_applySize() {
|
|
58
|
+
const lW = this.nsData.landscape?.width ?? this.nsData.width;
|
|
59
|
+
const lH = this.nsData.landscape?.height ?? this.nsData.height;
|
|
60
|
+
const pW = this.nsData.portrait?.width ?? lW;
|
|
61
|
+
const pH = this.nsData.portrait?.height ?? lH;
|
|
62
|
+
const isPortrait = this.currentTransform === this.portrait;
|
|
63
|
+
const w = isPortrait ? pW : lW;
|
|
64
|
+
const h = isPortrait ? pH : lH;
|
|
65
|
+
this.el.style.width = w + 'px';
|
|
66
|
+
this.el.style.height = h + 'px';
|
|
67
|
+
this.innerDiv.style.width = w + 'px';
|
|
68
|
+
this.innerDiv.style.height = h + 'px';
|
|
69
|
+
}
|
|
70
|
+
getType() { return 'ZNineSlice'; }
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ZNineSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZNineSlice.js","sourceRoot":"","sources":["../src/ZNineSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAC9B,QAAQ,CAAiB;IACzB,MAAM,CAAgB;IAE9B,YACI,IAAmB,EACnB,WAAqC,EACrC,aAAqB;QAErB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,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C,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC;IAC1C,CAAC;IAEM,OAAO,KAAa,OAAO,YAAY,CAAC,CAAC,CAAC;CACpD"}
|
package/dist/ZPool.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ZContainer } from './ZContainer';
|
|
2
|
+
/**
|
|
3
|
+
* Simple object pool. Identical to the Phaser version — no engine-specific
|
|
4
|
+
* code was needed.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ZPool {
|
|
7
|
+
private dict;
|
|
8
|
+
private static instance;
|
|
9
|
+
private constructor();
|
|
10
|
+
static getInstance(): ZPool;
|
|
11
|
+
init(_numElements: number, symbolTemplate: string, type: string): void;
|
|
12
|
+
clear(type: string): void;
|
|
13
|
+
get(type: string): ZContainer;
|
|
14
|
+
putBack(e: ZContainer, type: string): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ZPool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZPool.d.ts","sourceRoot":"","sources":["../src/ZPool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,qBAAa,KAAK;IACd,OAAO,CAAC,IAAI,CAA8B;IAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAE7C,OAAO;WAMO,WAAW,IAAI,KAAK;IAI3B,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAatE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKzB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAU7B,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;CAMpD"}
|
package/dist/ZPool.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ZSceneStack } from './ZSceneStack';
|
|
2
|
+
/**
|
|
3
|
+
* Simple object pool. Identical to the Phaser version — no engine-specific
|
|
4
|
+
* code was needed.
|
|
5
|
+
*/
|
|
6
|
+
export class ZPool {
|
|
7
|
+
dict = {};
|
|
8
|
+
static instance = new ZPool();
|
|
9
|
+
constructor() {
|
|
10
|
+
if (ZPool._instance) {
|
|
11
|
+
throw new Error('ZPool is a singleton — use ZPool.getInstance()');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
static getInstance() {
|
|
15
|
+
return ZPool.instance;
|
|
16
|
+
}
|
|
17
|
+
init(_numElements, symbolTemplate, type) {
|
|
18
|
+
this.dict[type] = {
|
|
19
|
+
curIndex: 0,
|
|
20
|
+
numElements: _numElements,
|
|
21
|
+
CLS: symbolTemplate,
|
|
22
|
+
pool: new Array(_numElements),
|
|
23
|
+
};
|
|
24
|
+
const pool = this.dict[type].pool;
|
|
25
|
+
for (let i = 0; i < _numElements; i++) {
|
|
26
|
+
pool[i] = ZSceneStack.spawn(symbolTemplate);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
clear(type) {
|
|
30
|
+
if (!this.dict[type])
|
|
31
|
+
throw new Error(`ZPool: pool "${type}" does not exist`);
|
|
32
|
+
this.dict[type].curIndex = 0;
|
|
33
|
+
}
|
|
34
|
+
get(type) {
|
|
35
|
+
if (!this.dict[type])
|
|
36
|
+
throw new Error(`ZPool: pool "${type}" does not exist`);
|
|
37
|
+
const obj = this.dict[type];
|
|
38
|
+
const e = obj.pool[obj.curIndex];
|
|
39
|
+
if (e == null)
|
|
40
|
+
throw new Error(`ZPool: pool "${type}" limit exceeded (${obj.curIndex})`);
|
|
41
|
+
if (obj.fnctn)
|
|
42
|
+
obj.fnctn(e);
|
|
43
|
+
obj.curIndex++;
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
putBack(e, type) {
|
|
47
|
+
if (!this.dict[type])
|
|
48
|
+
throw new Error(`ZPool: pool "${type}" does not exist`);
|
|
49
|
+
const obj = this.dict[type];
|
|
50
|
+
obj.curIndex--;
|
|
51
|
+
obj.pool[obj.curIndex] = e;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ZPool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZPool.js","sourceRoot":"","sources":["../src/ZPool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;;GAGG;AACH,MAAM,OAAO,KAAK;IACN,IAAI,GAA2B,EAAE,CAAC;IAClC,MAAM,CAAC,QAAQ,GAAU,IAAI,KAAK,EAAE,CAAC;IAE7C;QACI,IAAK,KAAa,CAAC,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACtE,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,WAAW;QACrB,OAAO,KAAK,CAAC,QAAQ,CAAC;IAC1B,CAAC;IAEM,IAAI,CAAC,YAAoB,EAAE,cAAsB,EAAE,IAAY;QAClE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACd,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE,YAAY;YACzB,GAAG,EAAE,cAAc;YACnB,IAAI,EAAE,IAAI,KAAK,CAAC,YAAY,CAAC;SAChC,CAAC;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,IAAI,CAAC,CAAC,CAAC,GAAG,WAAW,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
|
+
/** Static registry for objects that need to react to viewport resize. */
|
|
2
|
+
export declare class ZResizeables {
|
|
3
|
+
static resizeables: Map<any, boolean>;
|
|
4
|
+
static addResizeable(mc: any): void;
|
|
5
|
+
static resize(): void;
|
|
6
|
+
static removeResizeable(mc: any): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ZResizeables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZResizeables.d.ts","sourceRoot":"","sources":["../src/ZResizeables.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,qBAAa,YAAY;IACrB,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAa;IAElD,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,GAAG,GAAG,IAAI;IAInC,MAAM,CAAC,MAAM,IAAI,IAAI;IAMrB,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,GAAG,GAAG,IAAI;CAGzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Static registry for objects that need to react to viewport resize. */
|
|
2
|
+
export class ZResizeables {
|
|
3
|
+
static resizeables = new Map();
|
|
4
|
+
static addResizeable(mc) {
|
|
5
|
+
ZResizeables.resizeables.set(mc, true);
|
|
6
|
+
}
|
|
7
|
+
static resize() {
|
|
8
|
+
for (const [key] of ZResizeables.resizeables) {
|
|
9
|
+
key.resize();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
static removeResizeable(mc) {
|
|
13
|
+
ZResizeables.resizeables.delete(mc);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ZResizeables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZResizeables.js","sourceRoot":"","sources":["../src/ZResizeables.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,OAAO,YAAY;IACrB,MAAM,CAAC,WAAW,GAAsB,IAAI,GAAG,EAAE,CAAC;IAElD,MAAM,CAAC,aAAa,CAAC,EAAO;QACxB,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,MAAM;QACT,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;YAC1C,GAAW,CAAC,MAAM,EAAE,CAAC;QAC1B,CAAC;IACL,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,EAAO;QAC3B,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC"}
|
package/dist/ZScene.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ZContainer } from './ZContainer';
|
|
2
|
+
import { AnimTrackData, SceneData, TemplateData } from './SceneData';
|
|
3
|
+
export type AssetType = 'btn' | 'asset' | 'state' | 'toggle' | 'none' | 'slider' | 'scrollBar' | 'fullScreen' | 'animation';
|
|
4
|
+
/**
|
|
5
|
+
* HTML div–based ZScene.
|
|
6
|
+
*
|
|
7
|
+
* Loads `placements.json` from an asset base path, constructs the scene
|
|
8
|
+
* hierarchy as nested `ZContainer` divs, scales and centres the stage to
|
|
9
|
+
* fit the viewport, and exposes the same public API as the PIXI / Phaser
|
|
10
|
+
* versions of zImporter.
|
|
11
|
+
*
|
|
12
|
+
* Spine and particle assets are silently skipped (not supported in HTML).
|
|
13
|
+
*/
|
|
14
|
+
export declare class ZScene {
|
|
15
|
+
static assetTypes: Map<AssetType, any>;
|
|
16
|
+
private assetBasePath;
|
|
17
|
+
private data;
|
|
18
|
+
private _sceneStage;
|
|
19
|
+
private resizeMap;
|
|
20
|
+
private static SceneMap;
|
|
21
|
+
private sceneId;
|
|
22
|
+
private orientation;
|
|
23
|
+
/** Atlas frame rects keyed by frame name (no _IMG suffix). Populated when atlas:true. */
|
|
24
|
+
private atlasFrames;
|
|
25
|
+
/** Full URL of the atlas image (ta.png). */
|
|
26
|
+
private atlasImageUrl;
|
|
27
|
+
/** Full atlas image dimensions (needed for background-size). */
|
|
28
|
+
private atlasSize;
|
|
29
|
+
/** Parsed bitmap fonts keyed by uniqueFontName (e.g. "Arial_1e00ffa19b9b_53"). */
|
|
30
|
+
private bitmapFonts;
|
|
31
|
+
get sceneStage(): ZContainer;
|
|
32
|
+
get sceneWidth(): number;
|
|
33
|
+
get sceneHeight(): number;
|
|
34
|
+
constructor(sceneId: string);
|
|
35
|
+
setOrientation(): void;
|
|
36
|
+
static getSceneById(sceneId: string): ZScene | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Fetches `placements.json` (and `ta.json` when atlas:true) from
|
|
39
|
+
* `assetBasePath` and builds the scene.
|
|
40
|
+
*/
|
|
41
|
+
load(assetBasePath: string, onComplete: () => void): Promise<void>;
|
|
42
|
+
/** Fetches ta.json and ta.png metadata and caches the frame rects. */
|
|
43
|
+
private _loadAtlas;
|
|
44
|
+
private _loadFonts;
|
|
45
|
+
private _loadBitmapFont;
|
|
46
|
+
/**
|
|
47
|
+
* Renders a bitmapText node onto a <canvas> using the pre-parsed glyph
|
|
48
|
+
* atlas. Supports solid-colour and vertical-gradient fills, plus a
|
|
49
|
+
* shadow-based stroke outline that matches PIXI's strokeThickness.
|
|
50
|
+
*/
|
|
51
|
+
private _createBitmapTextCanvas;
|
|
52
|
+
initScene(data: SceneData): void;
|
|
53
|
+
/**
|
|
54
|
+
* Builds the scene's div hierarchy and appends it to `hostElement`.
|
|
55
|
+
* @param hostElement - The DOM node that will contain the stage (default: document.body).
|
|
56
|
+
*/
|
|
57
|
+
loadStage(hostElement?: HTMLElement, loadChildren?: boolean): void;
|
|
58
|
+
addToResizeMap(mc: ZContainer): void;
|
|
59
|
+
removeFromResizeMap(mc: ZContainer): void;
|
|
60
|
+
getInnerDimensions(): {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Scales and centres the stage div to fill the viewport while preserving
|
|
66
|
+
* the scene's internal aspect ratio. Mirrors ZScene.resize in PIXI.
|
|
67
|
+
*/
|
|
68
|
+
resize(width: number, height: number): void;
|
|
69
|
+
spawn(tempName: string): ZContainer | undefined;
|
|
70
|
+
createAsset(mc: ZContainer, baseNode: TemplateData): void;
|
|
71
|
+
private _createImageElement;
|
|
72
|
+
private _createTextElement;
|
|
73
|
+
getChildrenFrames(templateName: string): Record<string, AnimTrackData[]>;
|
|
74
|
+
static getAssetType(value: string): (new () => ZContainer) | null;
|
|
75
|
+
static isAssetType(value: string): value is AssetType;
|
|
76
|
+
degreesToRadians(degrees: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* Removes the scene's stage element from the DOM and clears the scene map.
|
|
79
|
+
*/
|
|
80
|
+
destroy(): void;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ZScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZScene.d.ts","sourceRoot":"","sources":["../src/ZScene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EACH,aAAa,EACb,SAAS,EAAyB,YAAY,EACjD,MAAM,aAAa,CAAC;AAcrB,MAAM,MAAM,SAAS,GACf,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAC7C,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAE1D;;;;;;;;;GASG;AACH,qBAAa,MAAM;IAEf,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CASnC;IAEH,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,WAAW,CAAgC;IACnD,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IACzD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,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