lyb-pixi-js 1.11.7 → 1.11.9
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/Components/Base/LibDestroyContainer.d.ts +11 -0
- package/Components/Base/LibDestroyContainer.js +28 -0
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.d.ts +1 -1
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.js +2 -2
- package/libPixiJs.d.ts +3 -0
- package/libPixiJs.js +3 -0
- package/lyb-pixi.js +15 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Container } from "pixi.js";
|
|
2
|
+
/** @description 带销毁的容器 */
|
|
3
|
+
export declare class LibDestroyContainer extends Container {
|
|
4
|
+
/** 销毁之前 */
|
|
5
|
+
protected _onBeforeDestroy?: () => void | Promise<void>;
|
|
6
|
+
/** 已销毁 */
|
|
7
|
+
protected _onDestroyed?: () => void;
|
|
8
|
+
constructor();
|
|
9
|
+
/** @description 销毁 */
|
|
10
|
+
destroy(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Container } from "pixi.js";
|
|
11
|
+
/** @description 带销毁的容器 */
|
|
12
|
+
export class LibDestroyContainer extends Container {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
/** @description 销毁 */
|
|
17
|
+
destroy() {
|
|
18
|
+
const _super = Object.create(null, {
|
|
19
|
+
destroy: { get: () => super.destroy }
|
|
20
|
+
});
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
yield ((_a = this._onBeforeDestroy) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
24
|
+
_super.destroy.call(this, { children: true });
|
|
25
|
+
(_b = this._onDestroyed) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -16,7 +16,7 @@ export declare class LibPixiDialog extends LibPixiBaseContainer {
|
|
|
16
16
|
static durationIn: number;
|
|
17
17
|
static durationOut: number;
|
|
18
18
|
/** 是否支持横竖版 */
|
|
19
|
-
static adaptation:
|
|
19
|
+
static adaptation: "hv" | "h" | "v";
|
|
20
20
|
/** 蒙版UI */
|
|
21
21
|
private _maskUI;
|
|
22
22
|
/** 内容容器 */
|
|
@@ -63,7 +63,7 @@ export class LibPixiDialog extends LibPixiBaseContainer {
|
|
|
63
63
|
duration: LibPixiDialog.durationIn,
|
|
64
64
|
alpha: 1,
|
|
65
65
|
});
|
|
66
|
-
const resize = new LibJsResizeWatcher(LibPixiDialog.adaptation
|
|
66
|
+
const resize = new LibJsResizeWatcher(LibPixiDialog.adaptation);
|
|
67
67
|
this._offResize = resize.on((w, h) => {
|
|
68
68
|
const halfW = 1920 / 2;
|
|
69
69
|
const halfH = 1080 / 2;
|
|
@@ -126,4 +126,4 @@ LibPixiDialog.bgAlpha = 0.5;
|
|
|
126
126
|
LibPixiDialog.durationIn = 0.5;
|
|
127
127
|
LibPixiDialog.durationOut = 0.5;
|
|
128
128
|
/** 是否支持横竖版 */
|
|
129
|
-
LibPixiDialog.adaptation =
|
|
129
|
+
LibPixiDialog.adaptation = "hv";
|
package/libPixiJs.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { LibPixiCircular } from "./Components/Base/LibPixiCircular";
|
|
|
26
26
|
import { LibPixiSlide } from "./Components/Custom/LibPixiSlide";
|
|
27
27
|
import { LibPixiLabelValue } from "./Components/Custom/LibPixiLabelValue";
|
|
28
28
|
import { LibPixiPuzzleBg } from "./Components/Custom/LibPixiPuzzleBg";
|
|
29
|
+
import { LibDestroyContainer } from "./Components/Base/LibDestroyContainer";
|
|
29
30
|
/** @description 组件 */
|
|
30
31
|
export declare const Components: {
|
|
31
32
|
Base: {
|
|
@@ -69,6 +70,8 @@ export declare const Components: {
|
|
|
69
70
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
|
|
70
71
|
*/
|
|
71
72
|
LibPixiHtmlText: typeof LibPixiHtmlText;
|
|
73
|
+
/** @description 带销毁的容器 */
|
|
74
|
+
LibDestroyContainer: typeof LibDestroyContainer;
|
|
72
75
|
};
|
|
73
76
|
Custom: {
|
|
74
77
|
/** @description 悬浮切换材质
|
package/libPixiJs.js
CHANGED
|
@@ -44,6 +44,7 @@ import { LibPixiPuzzleBg } from "./Components/Custom/LibPixiPuzzleBg";
|
|
|
44
44
|
import { libContainerCenter } from "./Utils/LibContainerCenter";
|
|
45
45
|
import { libPixiHVCenter } from "./Utils/LibPixiHVCenter";
|
|
46
46
|
import { libPixiHVGap } from "./Utils/LibPixiHVGap";
|
|
47
|
+
import { LibDestroyContainer } from "./Components/Base/LibDestroyContainer";
|
|
47
48
|
/** @description 组件 */
|
|
48
49
|
export const Components = {
|
|
49
50
|
Base: {
|
|
@@ -87,6 +88,8 @@ export const Components = {
|
|
|
87
88
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
|
|
88
89
|
*/
|
|
89
90
|
LibPixiHtmlText,
|
|
91
|
+
/** @description 带销毁的容器 */
|
|
92
|
+
LibDestroyContainer,
|
|
90
93
|
},
|
|
91
94
|
Custom: {
|
|
92
95
|
/** @description 悬浮切换材质
|
package/lyb-pixi.js
CHANGED
|
@@ -57816,6 +57816,18 @@ void main(void){
|
|
|
57816
57816
|
}
|
|
57817
57817
|
});
|
|
57818
57818
|
};
|
|
57819
|
+
class LibDestroyContainer extends Container {
|
|
57820
|
+
constructor() {
|
|
57821
|
+
super();
|
|
57822
|
+
}
|
|
57823
|
+
/** @description 销毁 */
|
|
57824
|
+
async destroy() {
|
|
57825
|
+
var _a, _b;
|
|
57826
|
+
await ((_a = this._onBeforeDestroy) == null ? void 0 : _a.call(this));
|
|
57827
|
+
super.destroy({ children: true });
|
|
57828
|
+
(_b = this._onDestroyed) == null ? void 0 : _b.call(this);
|
|
57829
|
+
}
|
|
57830
|
+
}
|
|
57819
57831
|
const Components = {
|
|
57820
57832
|
Base: {
|
|
57821
57833
|
/** @description 自定义位图文本
|
|
@@ -57857,7 +57869,9 @@ void main(void){
|
|
|
57857
57869
|
/** @description 自定义富文本类
|
|
57858
57870
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
|
|
57859
57871
|
*/
|
|
57860
|
-
LibPixiHtmlText
|
|
57872
|
+
LibPixiHtmlText,
|
|
57873
|
+
/** @description 带销毁的容器 */
|
|
57874
|
+
LibDestroyContainer
|
|
57861
57875
|
},
|
|
57862
57876
|
Custom: {
|
|
57863
57877
|
/** @description 悬浮切换材质
|