lyb-pixi-js 1.12.37 → 1.12.39

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.
@@ -30,8 +30,8 @@ export declare class LibPixiDialog extends LibPixiBaseContainer {
30
30
  constructor(params?: Params);
31
31
  /** @description 设置弹窗内容 */
32
32
  setDialogContent(content: Container): void;
33
- /** @description 设置弹窗容器锚点 */
34
- updatePivot(): void;
33
+ /** @description 更新弹窗容器坐标 */
34
+ updatePosition(w: number, h: number): void;
35
35
  /** @description 关闭 */
36
36
  close(): Promise<void>;
37
37
  /** @description 重绘弹窗 */
@@ -48,7 +48,6 @@ export class LibPixiDialog extends LibPixiBaseContainer {
48
48
  this._dialogContainer.addChild(content);
49
49
  this._dialogContainer.alpha = 0;
50
50
  requestAnimationFrame(() => {
51
- this.updatePivot();
52
51
  if (LibPixiDialog.adaptation === "h") {
53
52
  this._redraw(1920, 1080);
54
53
  }
@@ -68,11 +67,20 @@ export class LibPixiDialog extends LibPixiBaseContainer {
68
67
  });
69
68
  });
70
69
  }
71
- /** @description 设置弹窗容器锚点 */
72
- updatePivot() {
73
- const dialogW = this._dialogContainer.width / 2;
74
- const dialogH = this._dialogContainer.height / 2;
75
- this._dialogContainer.pivot.set(dialogW, dialogH);
70
+ /** @description 更新弹窗容器坐标 */
71
+ updatePosition(w, h) {
72
+ const bounds = this._dialogContainer.getLocalBounds();
73
+ const dialogW = bounds.width / 2;
74
+ const dialogH = bounds.height / 2;
75
+ this._dialogContainer.pivot.set(bounds.x + dialogW, bounds.y + dialogH);
76
+ const halfW = 1920 / 2;
77
+ const halfH = 1080 / 2;
78
+ if (w > h) {
79
+ this._dialogContainer.position.set(halfW, halfH);
80
+ }
81
+ else {
82
+ this._dialogContainer.position.set(halfH, halfW);
83
+ }
76
84
  }
77
85
  /** @description 关闭 */
78
86
  close() {
@@ -104,22 +112,19 @@ export class LibPixiDialog extends LibPixiBaseContainer {
104
112
  return;
105
113
  this._lastIsH = w > h;
106
114
  let scale = 0;
107
- const halfW = 1920 / 2;
108
- const halfH = 1080 / 2;
109
115
  if (w > h) {
110
116
  this._maskUI.width = 2700;
111
117
  this._maskUI.height = 1080;
112
118
  this._maskUI.x = -(2700 - 1920) / 2;
113
- this._dialogContainer.position.set(halfW, halfH);
114
119
  scale = 1;
115
120
  }
116
121
  else {
117
122
  this._maskUI.width = 1080;
118
123
  this._maskUI.height = 2700;
119
124
  this._maskUI.x = 0;
120
- this._dialogContainer.position.set(halfH, halfW);
121
125
  scale = this._vScale;
122
126
  }
127
+ this.updatePosition(w, h);
123
128
  this._dialogContainer.scale.set(0);
124
129
  gsap.to(this._dialogContainer.scale, {
125
130
  duration: LibPixiDialog.durationIn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.12.37",
3
+ "version": "1.12.39",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {