lyb-pixi-js 1.9.17 → 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
- constructor(parent: Container);
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
- window.addEventListener("resize", () => {
12
- var _a;
13
- const w = window.innerWidth;
14
- const h = window.innerHeight;
15
- const orientation = w > h ? "h" : "v";
16
- if (orientation !== this.lastOrientation) {
17
- (_a = this.resize) === null || _a === void 0 ? void 0 : _a.call(this, window.innerWidth, window.innerHeight);
18
- this.lastOrientation = orientation;
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
- (_a = view.resize) === null || _a === void 0 ? void 0 : _a.call(view, window.innerWidth, window.innerHeight);
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
  }
@@ -12,8 +12,6 @@ interface Params {
12
12
  export declare class LibPixiDialog extends LibPixiBaseContainer {
13
13
  /** 蒙版UI */
14
14
  private maskUI;
15
- /** 居中容器 */
16
- private centerContainer;
17
15
  /** 内容容器 */
18
16
  private dialogContainer;
19
17
  /** 当前大小 */
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Container } from "pixi.js";
11
11
  import gsap from "gsap";
12
- import { LibPixiBaseContainer } from "./LibPixiBaseContainer";
13
12
  import { LibPixiRectBgColor } from "../../../Components/Base/LibPixiRectBgColor";
14
- import { libPixiEvent } from '../../LibPixiEvent';
13
+ import { libPixiEvent } from "../../LibPixiEvent";
14
+ import { LibPixiBaseContainer } from "./LibPixiBaseContainer";
15
15
  /** @description 弹窗组件 */
16
16
  export class LibPixiDialog extends LibPixiBaseContainer {
17
17
  constructor(params) {
@@ -24,9 +24,9 @@ export class LibPixiDialog extends LibPixiBaseContainer {
24
24
  this.initialSize = size;
25
25
  //蒙版
26
26
  this.maskUI = new LibPixiRectBgColor({
27
- bgColor: "#000",
28
27
  width: 2700,
29
28
  height: 1080,
29
+ bgColor: "#000",
30
30
  });
31
31
  this.addChild(this.maskUI);
32
32
  this.maskUI.alpha = 0;
@@ -39,23 +39,19 @@ export class LibPixiDialog extends LibPixiBaseContainer {
39
39
  onClickMask === null || onClickMask === void 0 ? void 0 : onClickMask();
40
40
  });
41
41
  }
42
- //居中容器
43
- this.centerContainer = new Container();
44
- this.addChild(this.centerContainer);
45
- this.centerContainer.eventMode = "static";
46
42
  //弹窗内容容器
47
43
  this.dialogContainer = new Container();
44
+ this.addChild(this.dialogContainer);
45
+ this.dialogContainer.eventMode = "static";
48
46
  }
49
47
  /** @description 设置弹窗内容 */
50
48
  setDialogContent(content) {
51
49
  this.dialogContainer.addChild(content);
52
- this.centerContainer.addChild(this.dialogContainer);
53
50
  const w = this.dialogContainer.width / 2;
54
51
  const h = this.dialogContainer.height / 2;
55
52
  this.dialogContainer.pivot.set(w, h);
56
53
  this.dialogContainer.scale.set(0);
57
54
  this.dialogContainer.alpha = 0;
58
- // this.dialogContainer.y = -55;
59
55
  gsap.to(this.maskUI, {
60
56
  duration: 0.5,
61
57
  alpha: 0.5,
@@ -70,7 +66,7 @@ export class LibPixiDialog extends LibPixiBaseContainer {
70
66
  if (w > h) {
71
67
  this.maskUI.renderBg(2700, 1080);
72
68
  this.maskUI.x = -(2700 - 1920) / 2;
73
- this.centerContainer.position.set(halfW, halfH);
69
+ this.dialogContainer.position.set(halfW, halfH);
74
70
  this.size = 1;
75
71
  if (this.dialogContainer.scale.x === this.initialSize) {
76
72
  this.dialogContainer.scale.set(1);
@@ -79,7 +75,7 @@ export class LibPixiDialog extends LibPixiBaseContainer {
79
75
  else {
80
76
  this.maskUI.renderBg(1080, 2700);
81
77
  this.maskUI.x = 0;
82
- this.centerContainer.position.set(halfH, halfW);
78
+ this.dialogContainer.position.set(halfH, halfW);
83
79
  this.size = this.initialSize;
84
80
  if (this.dialogContainer.scale.x === 1) {
85
81
  this.dialogContainer.scale.set(this.initialSize);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.9.17",
3
+ "version": "1.9.19",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {