lyb-pixi-js 1.12.15 → 1.12.17
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/Custom/LibPixiScrollContainerY.d.ts +2 -0
- package/Components/Custom/LibPixiScrollContainerY.js +16 -19
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.d.ts +2 -2
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.js +36 -38
- package/lyb-pixi.js +16 -19
- package/package.json +1 -1
|
@@ -63,6 +63,8 @@ export declare class LibPixiScrollContainerY extends LibPixiContainer {
|
|
|
63
63
|
/** 滚动触发 */
|
|
64
64
|
private _onScroll?;
|
|
65
65
|
constructor(params: LibPixiScrollContainerYParams);
|
|
66
|
+
/** @description 添加边距 */
|
|
67
|
+
addMargin(topMargin: number, bottomMargin: number): void;
|
|
66
68
|
/** @description 设置滚动容器可视区宽高
|
|
67
69
|
* @param width 宽度
|
|
68
70
|
* @param height 高度
|
|
@@ -8,7 +8,7 @@ import { LibPixiRectangle } from "../Base/LibPixiRectangle";
|
|
|
8
8
|
*/
|
|
9
9
|
export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
10
10
|
constructor(params) {
|
|
11
|
-
const { width, height, scrollbar = false, scrollContent, scrollbarRgiht = 0, scrollbarWidth = 10, scrollbarColor = "#ffffff", onScroll, bgColor,
|
|
11
|
+
const { width, height, scrollbar = false, scrollContent, scrollbarRgiht = 0, scrollbarWidth = 10, scrollbarColor = "#ffffff", onScroll, bgColor, } = params;
|
|
12
12
|
super(width, height, bgColor);
|
|
13
13
|
/** 开始位置 */
|
|
14
14
|
this._startY = 0;
|
|
@@ -36,24 +36,6 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
|
36
36
|
this._content = new Container();
|
|
37
37
|
this.addChild(this._content);
|
|
38
38
|
this._content.addChild(this._scrollContent);
|
|
39
|
-
if (topMargin) {
|
|
40
|
-
//创建底部边距
|
|
41
|
-
const topMarginBox = new Sprite();
|
|
42
|
-
this._content.addChild(topMarginBox);
|
|
43
|
-
topMarginBox.height = topMargin;
|
|
44
|
-
requestAnimationFrame(() => {
|
|
45
|
-
this._scrollContent.y += topMargin;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
if (bottomMargin) {
|
|
49
|
-
//创建底部边距
|
|
50
|
-
const bottomMarginBox = new Sprite();
|
|
51
|
-
this._content.addChild(bottomMarginBox);
|
|
52
|
-
bottomMarginBox.height = bottomMargin;
|
|
53
|
-
requestAnimationFrame(() => {
|
|
54
|
-
bottomMarginBox.y = topMargin + this._scrollContent.height;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
39
|
// 创建遮罩
|
|
58
40
|
this._maskGraphics = new LibPixiRectangle(width, height, "#000");
|
|
59
41
|
this.addChild(this._maskGraphics);
|
|
@@ -102,6 +84,21 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
|
102
84
|
this._onDragEnd();
|
|
103
85
|
});
|
|
104
86
|
}
|
|
87
|
+
/** @description 添加边距 */
|
|
88
|
+
addMargin(topMargin, bottomMargin) {
|
|
89
|
+
if (topMargin) {
|
|
90
|
+
const topMarginBox = new Sprite();
|
|
91
|
+
this._content.addChild(topMarginBox);
|
|
92
|
+
topMarginBox.height = topMargin;
|
|
93
|
+
this._scrollContent.y += topMargin;
|
|
94
|
+
}
|
|
95
|
+
if (bottomMargin) {
|
|
96
|
+
const bottomMarginBox = new Sprite();
|
|
97
|
+
this._content.addChild(bottomMarginBox);
|
|
98
|
+
bottomMarginBox.height = bottomMargin;
|
|
99
|
+
bottomMarginBox.y = topMargin + this._scrollContent.height;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
105
102
|
/** @description 设置滚动容器可视区宽高
|
|
106
103
|
* @param width 宽度
|
|
107
104
|
* @param height 高度
|
|
@@ -25,13 +25,13 @@ export declare class LibPixiDialog extends LibPixiBaseContainer {
|
|
|
25
25
|
private _size;
|
|
26
26
|
/** 竖版初始大小 */
|
|
27
27
|
private _initialSize;
|
|
28
|
-
/** 窗口变化 */
|
|
29
|
-
private _resize?;
|
|
30
28
|
/** 停止监听窗口 */
|
|
31
29
|
private _offResize?;
|
|
32
30
|
constructor(params?: Params);
|
|
33
31
|
/** @description 设置弹窗内容 */
|
|
34
32
|
setDialogContent(content: Container): void;
|
|
33
|
+
/** @description 重绘弹窗 */
|
|
34
|
+
redraw(w?: number, h?: number): void;
|
|
35
35
|
/** @description 关闭 */
|
|
36
36
|
close(): Promise<void>;
|
|
37
37
|
}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Container } from "pixi.js";
|
|
11
11
|
import gsap from "gsap";
|
|
12
12
|
import { LibJsResizeWatcher } from "lyb-js/Base/LibJsResizeWatcher.js";
|
|
13
|
-
import {
|
|
13
|
+
import { LibPixiRectangle } from "../../../Components/Base/LibPixiRectangle";
|
|
14
14
|
import { libPixiEvent } from "../../LibPixiEvent";
|
|
15
15
|
import { LibPixiBaseContainer } from "./LibPixiBaseContainer";
|
|
16
16
|
/** @description 弹窗组件 */
|
|
@@ -22,11 +22,7 @@ export class LibPixiDialog extends LibPixiBaseContainer {
|
|
|
22
22
|
const { size = 1, onClickMask, needBg = true } = params || {};
|
|
23
23
|
this._initialSize = size;
|
|
24
24
|
//蒙版
|
|
25
|
-
this._maskUI = new
|
|
26
|
-
width: 2700,
|
|
27
|
-
height: 1080,
|
|
28
|
-
bgColor: "#000",
|
|
29
|
-
});
|
|
25
|
+
this._maskUI = new LibPixiRectangle(2700, 1080, "#000");
|
|
30
26
|
this.addChild(this._maskUI);
|
|
31
27
|
this._maskUI.alpha = 0;
|
|
32
28
|
this._maskUI.eventMode = "static";
|
|
@@ -44,14 +40,13 @@ export class LibPixiDialog extends LibPixiBaseContainer {
|
|
|
44
40
|
this._dialogContainer = new Container();
|
|
45
41
|
this.addChild(this._dialogContainer);
|
|
46
42
|
this._dialogContainer.eventMode = "static";
|
|
43
|
+
const resize = new LibJsResizeWatcher(LibPixiDialog.adaptation);
|
|
44
|
+
this._offResize = resize.on(this.redraw.bind(this));
|
|
47
45
|
}
|
|
48
46
|
/** @description 设置弹窗内容 */
|
|
49
47
|
setDialogContent(content) {
|
|
50
|
-
var _a, _b;
|
|
51
48
|
this._dialogContainer.addChild(content);
|
|
52
|
-
|
|
53
|
-
const h = this._dialogContainer.height / 2;
|
|
54
|
-
this._dialogContainer.pivot.set(w, h);
|
|
49
|
+
this.redraw();
|
|
55
50
|
this._dialogContainer.scale.set(0);
|
|
56
51
|
this._dialogContainer.alpha = 0;
|
|
57
52
|
gsap.to(this._maskUI, {
|
|
@@ -62,36 +57,39 @@ export class LibPixiDialog extends LibPixiBaseContainer {
|
|
|
62
57
|
duration: LibPixiDialog.durationIn,
|
|
63
58
|
alpha: 1,
|
|
64
59
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
}
|
|
61
|
+
/** @description 重绘弹窗 */
|
|
62
|
+
redraw(w = window.innerWidth, h = window.innerHeight) {
|
|
63
|
+
const dialogW = this._dialogContainer.width / 2;
|
|
64
|
+
const dialogH = this._dialogContainer.height / 2;
|
|
65
|
+
this._dialogContainer.pivot.set(dialogW, dialogH);
|
|
66
|
+
const halfW = 1920 / 2;
|
|
67
|
+
const halfH = 1080 / 2;
|
|
68
|
+
if (w > h) {
|
|
69
|
+
this._maskUI.width = 2700;
|
|
70
|
+
this._maskUI.height = 1080;
|
|
71
|
+
this._maskUI.x = -(2700 - 1920) / 2;
|
|
72
|
+
this._dialogContainer.position.set(halfW, halfH);
|
|
73
|
+
this._size = 1;
|
|
74
|
+
if (this._dialogContainer.scale.x === this._initialSize) {
|
|
75
|
+
this._dialogContainer.scale.set(1);
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this._maskUI.width = 1080;
|
|
80
|
+
this._maskUI.height = 2700;
|
|
81
|
+
this._maskUI.x = 0;
|
|
82
|
+
this._dialogContainer.position.set(halfH, halfW);
|
|
83
|
+
this._size = this._initialSize;
|
|
84
|
+
if (this._dialogContainer.scale.x === 1) {
|
|
85
|
+
this._dialogContainer.scale.set(this._initialSize);
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
}
|
|
88
|
+
gsap.to(this._dialogContainer.scale, {
|
|
89
|
+
duration: LibPixiDialog.durationIn,
|
|
90
|
+
ease: "back.out",
|
|
91
|
+
x: this._size,
|
|
92
|
+
y: this._size,
|
|
95
93
|
});
|
|
96
94
|
}
|
|
97
95
|
/** @description 关闭 */
|
package/lyb-pixi.js
CHANGED
|
@@ -49359,9 +49359,7 @@ void main(void)\r
|
|
|
49359
49359
|
scrollbarWidth = 10,
|
|
49360
49360
|
scrollbarColor = "#ffffff",
|
|
49361
49361
|
onScroll,
|
|
49362
|
-
bgColor
|
|
49363
|
-
topMargin = 0,
|
|
49364
|
-
bottomMargin = 0
|
|
49362
|
+
bgColor
|
|
49365
49363
|
} = params;
|
|
49366
49364
|
super(width, height, bgColor);
|
|
49367
49365
|
this._startY = 0;
|
|
@@ -49381,22 +49379,6 @@ void main(void)\r
|
|
|
49381
49379
|
this._content = new Container();
|
|
49382
49380
|
this.addChild(this._content);
|
|
49383
49381
|
this._content.addChild(this._scrollContent);
|
|
49384
|
-
if (topMargin) {
|
|
49385
|
-
const topMarginBox = new Sprite();
|
|
49386
|
-
this._content.addChild(topMarginBox);
|
|
49387
|
-
topMarginBox.height = topMargin;
|
|
49388
|
-
requestAnimationFrame(() => {
|
|
49389
|
-
this._scrollContent.y += topMargin;
|
|
49390
|
-
});
|
|
49391
|
-
}
|
|
49392
|
-
if (bottomMargin) {
|
|
49393
|
-
const bottomMarginBox = new Sprite();
|
|
49394
|
-
this._content.addChild(bottomMarginBox);
|
|
49395
|
-
bottomMarginBox.height = bottomMargin;
|
|
49396
|
-
requestAnimationFrame(() => {
|
|
49397
|
-
bottomMarginBox.y = topMargin + this._scrollContent.height;
|
|
49398
|
-
});
|
|
49399
|
-
}
|
|
49400
49382
|
this._maskGraphics = new LibPixiRectangle(width, height, "#000");
|
|
49401
49383
|
this.addChild(this._maskGraphics);
|
|
49402
49384
|
this.mask = this._maskGraphics;
|
|
@@ -49449,6 +49431,21 @@ void main(void)\r
|
|
|
49449
49431
|
this._onDragEnd();
|
|
49450
49432
|
});
|
|
49451
49433
|
}
|
|
49434
|
+
/** @description 添加边距 */
|
|
49435
|
+
addMargin(topMargin, bottomMargin) {
|
|
49436
|
+
if (topMargin) {
|
|
49437
|
+
const topMarginBox = new Sprite();
|
|
49438
|
+
this._content.addChild(topMarginBox);
|
|
49439
|
+
topMarginBox.height = topMargin;
|
|
49440
|
+
this._scrollContent.y += topMargin;
|
|
49441
|
+
}
|
|
49442
|
+
if (bottomMargin) {
|
|
49443
|
+
const bottomMarginBox = new Sprite();
|
|
49444
|
+
this._content.addChild(bottomMarginBox);
|
|
49445
|
+
bottomMarginBox.height = bottomMargin;
|
|
49446
|
+
bottomMarginBox.y = topMargin + this._scrollContent.height;
|
|
49447
|
+
}
|
|
49448
|
+
}
|
|
49452
49449
|
/** @description 设置滚动容器可视区宽高
|
|
49453
49450
|
* @param width 宽度
|
|
49454
49451
|
* @param height 高度
|