lyb-pixi-js 1.9.18 → 1.9.19
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.
|
@@ -13,7 +13,9 @@ export declare class LibPixiDialogManager {
|
|
|
13
13
|
private lastOrientation;
|
|
14
14
|
/** open时显示的元素的父容器 */
|
|
15
15
|
private _openContainer;
|
|
16
|
-
|
|
16
|
+
/** 是否适配横竖屏 */
|
|
17
|
+
private _hv;
|
|
18
|
+
constructor(parent: Container, hv?: boolean);
|
|
17
19
|
/**
|
|
18
20
|
* 打开界面
|
|
19
21
|
* @param View 实例类型或构造方法
|
|
@@ -2,22 +2,27 @@ export { LibPixiBaseContainer } from "./ui/LibPixiBaseContainer";
|
|
|
2
2
|
export { LibPixiDialog } from "./ui/LibPixiDialog";
|
|
3
3
|
/** @description 弹窗管理器 */
|
|
4
4
|
export class LibPixiDialogManager {
|
|
5
|
-
constructor(parent) {
|
|
5
|
+
constructor(parent, hv = false) {
|
|
6
6
|
/** 视图表 */
|
|
7
7
|
this.views = {};
|
|
8
8
|
/** 上一次方向 */
|
|
9
9
|
this.lastOrientation = "h";
|
|
10
|
+
/** 是否适配横竖屏 */
|
|
11
|
+
this._hv = false;
|
|
10
12
|
this._openContainer = parent;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.lastOrientation
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
this._hv = hv;
|
|
14
|
+
if (hv) {
|
|
15
|
+
window.addEventListener("resize", () => {
|
|
16
|
+
var _a;
|
|
17
|
+
const w = window.innerWidth;
|
|
18
|
+
const h = window.innerHeight;
|
|
19
|
+
const orientation = w > h ? "h" : "v";
|
|
20
|
+
if (orientation !== this.lastOrientation) {
|
|
21
|
+
(_a = this.resize) === null || _a === void 0 ? void 0 : _a.call(this, window.innerWidth, window.innerHeight);
|
|
22
|
+
this.lastOrientation = orientation;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
/**
|
|
23
28
|
* 打开界面
|
|
@@ -25,10 +30,15 @@ export class LibPixiDialogManager {
|
|
|
25
30
|
* @param args 实例参数
|
|
26
31
|
*/
|
|
27
32
|
open(View, id, ...args) {
|
|
28
|
-
var _a;
|
|
33
|
+
var _a, _b;
|
|
29
34
|
const view = new View(...args);
|
|
30
35
|
this._openContainer.addChild(view);
|
|
31
|
-
(
|
|
36
|
+
if (this._hv) {
|
|
37
|
+
(_a = view.resize) === null || _a === void 0 ? void 0 : _a.call(view, window.innerWidth, window.innerHeight);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
(_b = view.resize) === null || _b === void 0 ? void 0 : _b.call(view, 1920, 1080);
|
|
41
|
+
}
|
|
32
42
|
this.views[id] = view;
|
|
33
43
|
return view;
|
|
34
44
|
}
|