lyb-pixi-js 1.12.31 → 1.12.33
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/README.md +50 -85
- package/index.js +5 -2
- package/lyb-pixi.js +209 -197
- package/package.json +1 -1
- package/Components/Base/LibDestroyContainer.d.ts +0 -11
- package/Components/Base/LibDestroyContainer.js +0 -28
- package/Components/Base/LibPixiArc.d.ts +0 -16
- package/Components/Base/LibPixiArc.js +0 -14
- package/Components/Base/LibPixiBitText.d.ts +0 -20
- package/Components/Base/LibPixiBitText.js +0 -26
- package/Components/Base/LibPixiCircular.d.ts +0 -7
- package/Components/Base/LibPixiCircular.js +0 -12
- package/Components/Base/LibPixiContainer.d.ts +0 -22
- package/Components/Base/LibPixiContainer.js +0 -51
- package/Components/Base/LibPixiHtmlText.d.ts +0 -31
- package/Components/Base/LibPixiHtmlText.js +0 -30
- package/Components/Base/LibPixiOval.d.ts +0 -5
- package/Components/Base/LibPixiOval.js +0 -10
- package/Components/Base/LibPixiParticleMove.d.ts +0 -101
- package/Components/Base/LibPixiParticleMove.js +0 -136
- package/Components/Base/LibPixiPolygon.d.ts +0 -7
- package/Components/Base/LibPixiPolygon.js +0 -15
- package/Components/Base/LibPixiRectBgColor.d.ts +0 -41
- package/Components/Base/LibPixiRectBgColor.js +0 -95
- package/Components/Base/LibPixiRectangle.d.ts +0 -7
- package/Components/Base/LibPixiRectangle.js +0 -15
- package/Components/Base/LibPixiRound.d.ts +0 -5
- package/Components/Base/LibPixiRound.js +0 -9
- package/Components/Base/LibPixiRoundedRect.d.ts +0 -5
- package/Components/Base/LibPixiRoundedRect.js +0 -10
- package/Components/Base/LibPixiSpine.d.ts +0 -58
- package/Components/Base/LibPixiSpine.js +0 -128
- package/Components/Base/LibPixiText.d.ts +0 -37
- package/Components/Base/LibPixiText.js +0 -35
- package/Components/Custom/LibPixiArrangeLinearV2.d.ts +0 -25
- package/Components/Custom/LibPixiArrangeLinearV2.js +0 -80
- package/Components/Custom/LibPixiButtonHover.d.ts +0 -40
- package/Components/Custom/LibPixiButtonHover.js +0 -53
- package/Components/Custom/LibPixiCapsule.d.ts +0 -5
- package/Components/Custom/LibPixiCapsule.js +0 -10
- package/Components/Custom/LibPixiCloseBtn.d.ts +0 -14
- package/Components/Custom/LibPixiCloseBtn.js +0 -36
- package/Components/Custom/LibPixiDragLocate.d.ts +0 -36
- package/Components/Custom/LibPixiDragLocate.js +0 -230
- package/Components/Custom/LibPixiDrawer.d.ts +0 -16
- package/Components/Custom/LibPixiDrawer.js +0 -59
- package/Components/Custom/LibPixiInput.d.ts +0 -75
- package/Components/Custom/LibPixiInput.js +0 -186
- package/Components/Custom/LibPixiLabelValue.d.ts +0 -30
- package/Components/Custom/LibPixiLabelValue.js +0 -26
- package/Components/Custom/LibPixiPerforMon.d.ts +0 -47
- package/Components/Custom/LibPixiPerforMon.js +0 -166
- package/Components/Custom/LibPixiProgress.d.ts +0 -33
- package/Components/Custom/LibPixiProgress.js +0 -47
- package/Components/Custom/LibPixiPuzzleBg.d.ts +0 -7
- package/Components/Custom/LibPixiPuzzleBg.js +0 -46
- package/Components/Custom/LibPixiScrollContainerX.d.ts +0 -71
- package/Components/Custom/LibPixiScrollContainerX.js +0 -189
- package/Components/Custom/LibPixiScrollContainerY.d.ts +0 -109
- package/Components/Custom/LibPixiScrollContainerY.js +0 -338
- package/Components/Custom/LibPixiScrollNum.d.ts +0 -67
- package/Components/Custom/LibPixiScrollNum.js +0 -184
- package/Components/Custom/LibPixiSlide.d.ts +0 -94
- package/Components/Custom/LibPixiSlide.js +0 -285
- package/Components/Custom/LibPixiSlider.d.ts +0 -82
- package/Components/Custom/LibPixiSlider.js +0 -165
- package/Components/Custom/LibPixiSubAddMinMax.d.ts +0 -40
- package/Components/Custom/LibPixiSubAddMinMax.js +0 -56
- package/Components/Custom/LibPixiTable.d.ts +0 -64
- package/Components/Custom/LibPixiTable.js +0 -76
- package/Components/Custom/LibPixiTextGroup.d.ts +0 -20
- package/Components/Custom/LibPixiTextGroup.js +0 -50
- package/Components/Custom/LibPixiTextGroupWrap.d.ts +0 -20
- package/Components/Custom/LibPixiTextGroupWrap.js +0 -50
- package/Components/Custom/LibPixiTriangle.d.ts +0 -5
- package/Components/Custom/LibPixiTriangle.js +0 -12
- package/Components/Custom/LibPixiTurntable.d.ts +0 -6
- package/Components/Custom/LibPixiTurntable.js +0 -14
- package/Utils/LibContainerCenter.d.ts +0 -3
- package/Utils/LibContainerCenter.js +0 -10
- package/Utils/LibControlledDelayedCall.d.ts +0 -5
- package/Utils/LibControlledDelayedCall.js +0 -20
- package/Utils/LibPixiArrangeLinear.d.ts +0 -16
- package/Utils/LibPixiArrangeLinear.js +0 -62
- package/Utils/LibPixiAudio.d.ts +0 -53
- package/Utils/LibPixiAudio.js +0 -168
- package/Utils/LibPixiCreateNineGrid.d.ts +0 -15
- package/Utils/LibPixiCreateNineGrid.js +0 -19
- package/Utils/LibPixiDialogManager/index.d.ts +0 -25
- package/Utils/LibPixiDialogManager/index.js +0 -43
- package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.d.ts +0 -11
- package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.js +0 -31
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.d.ts +0 -38
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.js +0 -133
- package/Utils/LibPixiDigitalIncreasingAnimation.d.ts +0 -18
- package/Utils/LibPixiDigitalIncreasingAnimation.js +0 -26
- package/Utils/LibPixiDownScaleAnimation.d.ts +0 -7
- package/Utils/LibPixiDownScaleAnimation.js +0 -33
- package/Utils/LibPixiEmitContainerEvent.d.ts +0 -7
- package/Utils/LibPixiEmitContainerEvent.js +0 -13
- package/Utils/LibPixiEvent.d.ts +0 -19
- package/Utils/LibPixiEvent.js +0 -68
- package/Utils/LibPixiFilter.d.ts +0 -9
- package/Utils/LibPixiFilter.js +0 -34
- package/Utils/LibPixiGlobalUpdater.d.ts +0 -15
- package/Utils/LibPixiGlobalUpdater.js +0 -21
- package/Utils/LibPixiGridLayout.d.ts +0 -10
- package/Utils/LibPixiGridLayout.js +0 -27
- package/Utils/LibPixiGridLayoutV2.d.ts +0 -27
- package/Utils/LibPixiGridLayoutV2.js +0 -37
- package/Utils/LibPixiHVCenter.d.ts +0 -7
- package/Utils/LibPixiHVCenter.js +0 -14
- package/Utils/LibPixiHVGap.d.ts +0 -8
- package/Utils/LibPixiHVGap.js +0 -26
- package/Utils/LibPixiIntervalTrigger.d.ts +0 -7
- package/Utils/LibPixiIntervalTrigger.js +0 -35
- package/Utils/LibPixiOutsideClick.d.ts +0 -8
- package/Utils/LibPixiOutsideClick.js +0 -22
- package/Utils/LibPixiOverflowHidden.d.ts +0 -6
- package/Utils/LibPixiOverflowHidden.js +0 -14
- package/Utils/LibPixiPolygonDrawTool.d.ts +0 -44
- package/Utils/LibPixiPolygonDrawTool.js +0 -114
- package/Utils/LibPixiPromiseTickerTimeout.d.ts +0 -6
- package/Utils/LibPixiPromiseTickerTimeout.js +0 -22
- package/Utils/LibPixiScaleContainer.d.ts +0 -8
- package/Utils/LibPixiScaleContainer.js +0 -14
- package/Utils/LibPixiShadow.d.ts +0 -17
- package/Utils/LibPixiShadow.js +0 -18
- package/Utils/LibPixiSlideInput.d.ts +0 -55
- package/Utils/LibPixiSlideInput.js +0 -61
- package/Utils/LibPixiTicker.d.ts +0 -14
- package/Utils/LibPixiTicker.js +0 -49
- package/Utils/LibPixiTickerTimeout.d.ts +0 -6
- package/Utils/LibPixiTickerTimeout.js +0 -22
- package/index.d.ts +0 -1
- package/libPixiJs.d.ts +0 -296
- package/libPixiJs.js +0 -315
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import gsap from "gsap";
|
|
2
|
-
import { libPixiEvent } from "../../Utils/LibPixiEvent";
|
|
3
|
-
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
4
|
-
/** @description 右上角关闭按钮,支持悬浮旋转动画
|
|
5
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCloseBtn-关闭按钮
|
|
6
|
-
*/
|
|
7
|
-
export class LibPixiCloseBtn extends LibPixiContainer {
|
|
8
|
-
constructor(params) {
|
|
9
|
-
const { sprite, onClick } = params;
|
|
10
|
-
super(sprite.width, sprite.height);
|
|
11
|
-
this.addChild(sprite);
|
|
12
|
-
sprite.anchor.set(0.5);
|
|
13
|
-
sprite.x = sprite.width / 2;
|
|
14
|
-
sprite.y = sprite.height / 2;
|
|
15
|
-
libPixiEvent(this, "pointerenter", () => {
|
|
16
|
-
gsap.to(sprite, {
|
|
17
|
-
duration: 0.25,
|
|
18
|
-
rotation: 180 * (Math.PI / 180),
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
const offLeave = libPixiEvent(this, "pointerleave", () => {
|
|
22
|
-
sprite.alpha = 1;
|
|
23
|
-
gsap.to(sprite, {
|
|
24
|
-
duration: 0.25,
|
|
25
|
-
rotation: 0,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
libPixiEvent(this, "pointerdown", () => {
|
|
29
|
-
sprite.alpha = 0.5;
|
|
30
|
-
});
|
|
31
|
-
libPixiEvent(this, "pointertap", () => {
|
|
32
|
-
onClick();
|
|
33
|
-
offLeave();
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Container } from "pixi.js";
|
|
2
|
-
/** @description 元素拖拽定位 */
|
|
3
|
-
export declare class LibPixiDragLocate extends Container {
|
|
4
|
-
static stage: Container;
|
|
5
|
-
/** 输入框 */
|
|
6
|
-
private _inputEl;
|
|
7
|
-
/** 搜索结果 */
|
|
8
|
-
private _resultEl;
|
|
9
|
-
/** 状态栏元素 */
|
|
10
|
-
private _statusBarEl;
|
|
11
|
-
/** 坐标元素 */
|
|
12
|
-
private _positionEl;
|
|
13
|
-
/** 当前坐标值 */
|
|
14
|
-
private _positionValue;
|
|
15
|
-
/** 是否处于定位状态 */
|
|
16
|
-
private _isLocalte;
|
|
17
|
-
/** 是否显示输入框 */
|
|
18
|
-
private _showInput;
|
|
19
|
-
/** 是否允许移动 */
|
|
20
|
-
private _allowMove;
|
|
21
|
-
/** 按下坐标 */
|
|
22
|
-
private _downPos;
|
|
23
|
-
/** 当前处于移动的元素 */
|
|
24
|
-
private _currentMoveContainer?;
|
|
25
|
-
constructor();
|
|
26
|
-
/** @description 创建输入框 */
|
|
27
|
-
private _createInput;
|
|
28
|
-
/** @description 创建用于展示搜索结果的列表 */
|
|
29
|
-
private _createResultList;
|
|
30
|
-
/** @description 创建搜索结果元素 */
|
|
31
|
-
private _createResultEl;
|
|
32
|
-
/** @description 创建状态栏 */
|
|
33
|
-
private _createStatusBar;
|
|
34
|
-
/** @description 递归搜索 */
|
|
35
|
-
private _findByName;
|
|
36
|
-
}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { Container, Ticker } from "pixi.js";
|
|
2
|
-
import gsap from "gsap";
|
|
3
|
-
import { libPixiFilter } from "../../Utils/LibPixiFilter";
|
|
4
|
-
import { libJsCopy } from "lyb-js/Browser/LibJsCopy.js";
|
|
5
|
-
/** @description 元素拖拽定位 */
|
|
6
|
-
export class LibPixiDragLocate extends Container {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
/** 当前坐标值 */
|
|
10
|
-
this._positionValue = "";
|
|
11
|
-
/** 是否处于定位状态 */
|
|
12
|
-
this._isLocalte = false;
|
|
13
|
-
/** 是否显示输入框 */
|
|
14
|
-
this._showInput = false;
|
|
15
|
-
/** 是否允许移动 */
|
|
16
|
-
this._allowMove = false;
|
|
17
|
-
/** 按下坐标 */
|
|
18
|
-
this._downPos = { x: 0, y: 0 };
|
|
19
|
-
window.addEventListener("keydown", (e) => {
|
|
20
|
-
if (e.ctrlKey && e.key.toLowerCase() === "q" && e.shiftKey) {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
if (this._isLocalte)
|
|
23
|
-
return;
|
|
24
|
-
this._showInput = !this._showInput;
|
|
25
|
-
}
|
|
26
|
-
if (e.key === "Escape") {
|
|
27
|
-
this._showInput = false;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
this._createInput();
|
|
31
|
-
this._createResultList();
|
|
32
|
-
this._createStatusBar();
|
|
33
|
-
LibPixiDragLocate.stage.on("pointerdown", (event) => {
|
|
34
|
-
if (!this._currentMoveContainer)
|
|
35
|
-
return;
|
|
36
|
-
this._allowMove = true;
|
|
37
|
-
const { x, y } = LibPixiDragLocate.stage.toLocal(event.global);
|
|
38
|
-
this._downPos = { x, y };
|
|
39
|
-
});
|
|
40
|
-
LibPixiDragLocate.stage.on("pointermove", (event) => {
|
|
41
|
-
if (!this._allowMove || !this._currentMoveContainer)
|
|
42
|
-
return;
|
|
43
|
-
const { x, y } = LibPixiDragLocate.stage.toLocal(event.global);
|
|
44
|
-
const dx = x - this._downPos.x;
|
|
45
|
-
const dy = y - this._downPos.y;
|
|
46
|
-
this._currentMoveContainer.x += dx;
|
|
47
|
-
this._currentMoveContainer.y += dy;
|
|
48
|
-
this._downPos = { x, y };
|
|
49
|
-
const posX = Math.round(this._currentMoveContainer.x);
|
|
50
|
-
const posY = Math.round(this._currentMoveContainer.y);
|
|
51
|
-
this._positionEl.textContent = `X: ${posX}, Y: ${posY}`;
|
|
52
|
-
this._positionValue = `xxx.position.set(${posX}, ${posY})`;
|
|
53
|
-
});
|
|
54
|
-
LibPixiDragLocate.stage.on("pointerup", () => {
|
|
55
|
-
this._allowMove = false;
|
|
56
|
-
}, this);
|
|
57
|
-
Ticker.shared.add(() => {
|
|
58
|
-
if (this._showInput) {
|
|
59
|
-
if (this._isLocalte) {
|
|
60
|
-
this._inputEl.style.display = "none";
|
|
61
|
-
this._resultEl.style.display = "none";
|
|
62
|
-
this._statusBarEl.style.display = "flex";
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
this._inputEl.style.display = "block";
|
|
66
|
-
this._resultEl.style.display = "flex";
|
|
67
|
-
this._statusBarEl.style.display = "none";
|
|
68
|
-
this._inputEl.focus();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this._inputEl.style.display = "none";
|
|
73
|
-
this._resultEl.style.display = "none";
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/** @description 创建输入框 */
|
|
78
|
-
_createInput() {
|
|
79
|
-
this._inputEl = document.createElement("input");
|
|
80
|
-
this._inputEl.type = "text";
|
|
81
|
-
this._inputEl.style.cssText = `
|
|
82
|
-
background-color: rgba(0,0,0,0.75);
|
|
83
|
-
border: 2px solid rgba(255,255,255,0.5);
|
|
84
|
-
color: #fff;
|
|
85
|
-
display: none;
|
|
86
|
-
font-size: 25px;
|
|
87
|
-
height: 50px;
|
|
88
|
-
left: 50%;
|
|
89
|
-
outline: none;
|
|
90
|
-
position: fixed;
|
|
91
|
-
text-align: center;
|
|
92
|
-
top: 25%;
|
|
93
|
-
transform: translate(-50%, -50%);
|
|
94
|
-
width: 50vw;
|
|
95
|
-
`;
|
|
96
|
-
document.body.appendChild(this._inputEl);
|
|
97
|
-
this._inputEl.addEventListener("input", () => {
|
|
98
|
-
const results = this._findByName(LibPixiDragLocate.stage, this._inputEl.value);
|
|
99
|
-
//创建搜索结果列表
|
|
100
|
-
this._resultEl.innerHTML = "";
|
|
101
|
-
const renderNode = (item) => {
|
|
102
|
-
const resultEl = this._createResultEl(item.node.constructor.name, item.node.name, item.depth);
|
|
103
|
-
this._resultEl.appendChild(resultEl);
|
|
104
|
-
gsap.killTweensOf(item.node);
|
|
105
|
-
//悬浮结果列表元素闪烁
|
|
106
|
-
resultEl.addEventListener("mouseenter", () => {
|
|
107
|
-
gsap.to(item.node, {
|
|
108
|
-
alpha: 0,
|
|
109
|
-
duration: 0.25,
|
|
110
|
-
yoyo: true,
|
|
111
|
-
ease: "none",
|
|
112
|
-
repeat: -1,
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
//离开结果后停止闪烁
|
|
116
|
-
resultEl.addEventListener("mouseleave", () => {
|
|
117
|
-
gsap.killTweensOf(item.node);
|
|
118
|
-
item.node.alpha = 1;
|
|
119
|
-
});
|
|
120
|
-
resultEl.addEventListener("click", () => {
|
|
121
|
-
gsap.killTweensOf(item.node);
|
|
122
|
-
this._currentMoveContainer = item.node;
|
|
123
|
-
item.node.alpha = 1;
|
|
124
|
-
item.node.filters = [libPixiFilter("desaturate", 0)];
|
|
125
|
-
this._isLocalte = true;
|
|
126
|
-
});
|
|
127
|
-
item.children.forEach(renderNode);
|
|
128
|
-
};
|
|
129
|
-
results.forEach(renderNode);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/** @description 创建用于展示搜索结果的列表 */
|
|
133
|
-
_createResultList() {
|
|
134
|
-
this._resultEl = document.createElement("div");
|
|
135
|
-
this._resultEl.style.cssText = `
|
|
136
|
-
background-color: rgba(0,0,0,0.75);
|
|
137
|
-
border: 2px solid rgba(255,255,255,0.5);
|
|
138
|
-
left: 50%;
|
|
139
|
-
transform: translateX(-50%);
|
|
140
|
-
height: 300px;
|
|
141
|
-
overflow-y: auto;
|
|
142
|
-
position: fixed;
|
|
143
|
-
display: none;
|
|
144
|
-
gap: 10px;
|
|
145
|
-
flex-direction: column;
|
|
146
|
-
top: calc(25% + 50px);
|
|
147
|
-
width: 50vw;
|
|
148
|
-
`;
|
|
149
|
-
document.body.appendChild(this._resultEl);
|
|
150
|
-
}
|
|
151
|
-
/** @description 创建搜索结果元素 */
|
|
152
|
-
_createResultEl(className, tagName, depth) {
|
|
153
|
-
const resultItem = document.createElement("div");
|
|
154
|
-
resultItem.style.cssText = `
|
|
155
|
-
display: flex;
|
|
156
|
-
justify-content: space-between;
|
|
157
|
-
padding: 5px 10px;
|
|
158
|
-
align-items: center;
|
|
159
|
-
width: 100%;
|
|
160
|
-
font-size: 25px;
|
|
161
|
-
background-color: rgba(255,255,255,0.1);
|
|
162
|
-
color: #fff;
|
|
163
|
-
padding-left: ${depth * 20}px;
|
|
164
|
-
`;
|
|
165
|
-
const classNameEl = document.createElement("div");
|
|
166
|
-
classNameEl.textContent = className;
|
|
167
|
-
resultItem.appendChild(classNameEl);
|
|
168
|
-
const tagNameEl = document.createElement("div");
|
|
169
|
-
tagNameEl.textContent = tagName;
|
|
170
|
-
resultItem.appendChild(tagNameEl);
|
|
171
|
-
return resultItem;
|
|
172
|
-
}
|
|
173
|
-
/** @description 创建状态栏 */
|
|
174
|
-
_createStatusBar() {
|
|
175
|
-
this._statusBarEl = document.createElement("div");
|
|
176
|
-
this._statusBarEl.style.cssText = `
|
|
177
|
-
align-items: center;
|
|
178
|
-
background-color: rgba(0,0,0,0.75);
|
|
179
|
-
border: 2px solid rgba(0, 255, 13, 0.5);
|
|
180
|
-
color: #fff;
|
|
181
|
-
display: none;
|
|
182
|
-
font-size: 25px;
|
|
183
|
-
justify-content: center;
|
|
184
|
-
position: fixed;
|
|
185
|
-
top: 25%;
|
|
186
|
-
height: 50px;
|
|
187
|
-
left: 50%;
|
|
188
|
-
transform: translate(-50%, -50%);
|
|
189
|
-
width: 50vw;
|
|
190
|
-
`;
|
|
191
|
-
this._positionEl = document.createElement("div");
|
|
192
|
-
this._statusBarEl.appendChild(this._positionEl);
|
|
193
|
-
document.body.appendChild(this._statusBarEl);
|
|
194
|
-
this._statusBarEl.addEventListener("click", () => {
|
|
195
|
-
this._isLocalte = false;
|
|
196
|
-
libJsCopy(this._positionValue);
|
|
197
|
-
if (this._currentMoveContainer) {
|
|
198
|
-
this._currentMoveContainer.filters = [];
|
|
199
|
-
this._currentMoveContainer = undefined;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
/** @description 递归搜索 */
|
|
204
|
-
_findByName(root, keyword) {
|
|
205
|
-
if (!keyword)
|
|
206
|
-
return [];
|
|
207
|
-
const match = (node) => {
|
|
208
|
-
var _a;
|
|
209
|
-
return ((_a = node.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(keyword.toLowerCase())) ||
|
|
210
|
-
node.constructor.name.toLowerCase().includes(keyword.toLowerCase());
|
|
211
|
-
};
|
|
212
|
-
const dfs = (node, depth) => {
|
|
213
|
-
const children = node.children
|
|
214
|
-
.filter((c) => c instanceof Container)
|
|
215
|
-
.flatMap((c) => dfs(c, depth + 1));
|
|
216
|
-
if (match(node) || children.length > 0) {
|
|
217
|
-
return [
|
|
218
|
-
{
|
|
219
|
-
node,
|
|
220
|
-
depth,
|
|
221
|
-
children,
|
|
222
|
-
expanded: true,
|
|
223
|
-
},
|
|
224
|
-
];
|
|
225
|
-
}
|
|
226
|
-
return [];
|
|
227
|
-
};
|
|
228
|
-
return dfs(root, 0);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Container } from "pixi.js";
|
|
2
|
-
/** @description 底部弹出抽屉
|
|
3
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDrawer-抽屉
|
|
4
|
-
*/
|
|
5
|
-
export declare class LibPixiDrawer extends Container {
|
|
6
|
-
/** 蒙版UI */
|
|
7
|
-
private _maskUI;
|
|
8
|
-
/** 抽屉容器 */
|
|
9
|
-
private _drawerContainer;
|
|
10
|
-
/**
|
|
11
|
-
* @param content 抽屉内容
|
|
12
|
-
*/
|
|
13
|
-
constructor(content: Container);
|
|
14
|
-
/** @description 关闭 */
|
|
15
|
-
close(): Promise<void>;
|
|
16
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
import gsap from "gsap";
|
|
12
|
-
import { LibPixiRectBgColor } from '../Base/LibPixiRectBgColor';
|
|
13
|
-
/** @description 底部弹出抽屉
|
|
14
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDrawer-抽屉
|
|
15
|
-
*/
|
|
16
|
-
export class LibPixiDrawer extends Container {
|
|
17
|
-
/**
|
|
18
|
-
* @param content 抽屉内容
|
|
19
|
-
*/
|
|
20
|
-
constructor(content) {
|
|
21
|
-
super();
|
|
22
|
-
//蒙版
|
|
23
|
-
this._maskUI = new LibPixiRectBgColor({
|
|
24
|
-
bgColor: "#000",
|
|
25
|
-
width: 1080,
|
|
26
|
-
height: 1920,
|
|
27
|
-
});
|
|
28
|
-
this.addChild(this._maskUI);
|
|
29
|
-
this._maskUI.alpha = 0;
|
|
30
|
-
this._maskUI.eventMode = "static";
|
|
31
|
-
//弹窗内容容器
|
|
32
|
-
this._drawerContainer = content;
|
|
33
|
-
this.addChild(this._drawerContainer);
|
|
34
|
-
this._drawerContainer.y = this._maskUI.height;
|
|
35
|
-
gsap.to(this._maskUI, {
|
|
36
|
-
duration: 0.25,
|
|
37
|
-
alpha: 0.5,
|
|
38
|
-
});
|
|
39
|
-
gsap.to(this._drawerContainer, {
|
|
40
|
-
duration: 0.25,
|
|
41
|
-
ease: "power1.out",
|
|
42
|
-
y: this._maskUI.height - this._drawerContainer.height,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** @description 关闭 */
|
|
46
|
-
close() {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
gsap.to(this._drawerContainer, {
|
|
49
|
-
duration: 0.25,
|
|
50
|
-
y: this._maskUI.height,
|
|
51
|
-
});
|
|
52
|
-
yield gsap.to(this._maskUI, {
|
|
53
|
-
duration: 0.25,
|
|
54
|
-
delay: 0.125,
|
|
55
|
-
alpha: 0,
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Container } from "pixi.js";
|
|
2
|
-
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
3
|
-
interface Params {
|
|
4
|
-
/** 宽度 */
|
|
5
|
-
width: number;
|
|
6
|
-
/** 高度 */
|
|
7
|
-
height: number;
|
|
8
|
-
/** 字体与高度比 */
|
|
9
|
-
fontSizeRatio: number;
|
|
10
|
-
/** 使用字体 */
|
|
11
|
-
fontFamily?: string;
|
|
12
|
-
/** 是否加粗 */
|
|
13
|
-
bold?: boolean;
|
|
14
|
-
/** 是否需要placeholder */
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
/** placeholder颜色 */
|
|
17
|
-
placeholderColor?: string;
|
|
18
|
-
/** 背景色,用于调试输入框的位置 */
|
|
19
|
-
bgColor?: string;
|
|
20
|
-
/** 输入类型 */
|
|
21
|
-
type?: "number" | "text" | "password";
|
|
22
|
-
/** 字体颜色 */
|
|
23
|
-
color?: string;
|
|
24
|
-
/** 初始值 */
|
|
25
|
-
value?: string;
|
|
26
|
-
/** 是否整数 */
|
|
27
|
-
integer?: boolean;
|
|
28
|
-
/** 是否允许输入负数 */
|
|
29
|
-
isNegative?: boolean;
|
|
30
|
-
/** 最小值 */
|
|
31
|
-
min?: number;
|
|
32
|
-
/** 最大值 */
|
|
33
|
-
max?: number;
|
|
34
|
-
/** 最大长度 */
|
|
35
|
-
maxLength?: number;
|
|
36
|
-
/** 对齐方式 */
|
|
37
|
-
align?: "left" | "center";
|
|
38
|
-
/** 输入回调 */
|
|
39
|
-
onInput?: (text: number | string) => void;
|
|
40
|
-
/** 失去焦点回调 */
|
|
41
|
-
onValue?: (text: number | string) => void;
|
|
42
|
-
/** 格式化显示值 */
|
|
43
|
-
onFormatValue?: (text: number | string) => string;
|
|
44
|
-
}
|
|
45
|
-
/** @description 动态缩放移动输入框 */
|
|
46
|
-
export declare class LibPixiInput extends LibPixiContainer {
|
|
47
|
-
/** 舞台 */
|
|
48
|
-
static stage: Container;
|
|
49
|
-
/** 参数 */
|
|
50
|
-
private _params;
|
|
51
|
-
/** 只读输入框 */
|
|
52
|
-
private _readonlyInput;
|
|
53
|
-
/** placeholder */
|
|
54
|
-
private _placeholder;
|
|
55
|
-
/** 输入框dom */
|
|
56
|
-
private _input;
|
|
57
|
-
/** 当前输入的值 */
|
|
58
|
-
private _value;
|
|
59
|
-
constructor(params: Params);
|
|
60
|
-
/** @description 设置值 */
|
|
61
|
-
setValue(v: string): void;
|
|
62
|
-
/** @description 创建输入框 */
|
|
63
|
-
private _createInput;
|
|
64
|
-
/** @description 创建只读输入框 */
|
|
65
|
-
private _createReadOnlyInput;
|
|
66
|
-
/** @description 聚焦 */
|
|
67
|
-
private _focus;
|
|
68
|
-
/** @description 失焦 */
|
|
69
|
-
private _blur;
|
|
70
|
-
/** @description 失去焦点处理 */
|
|
71
|
-
private _onBlurHandler;
|
|
72
|
-
/** @description 实时更新输入框位置 */
|
|
73
|
-
private _updateInputPosition;
|
|
74
|
-
}
|
|
75
|
-
export {};
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { Ticker } from "pixi.js";
|
|
2
|
-
import Decimal from "decimal.js";
|
|
3
|
-
import { libPixiEvent } from "../../Utils/LibPixiEvent";
|
|
4
|
-
import { libPixiScaleContainer } from "../../Utils/LibPixiScaleContainer";
|
|
5
|
-
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
6
|
-
import { LibPixiText } from "../Base/LibPixiText";
|
|
7
|
-
/** @description 动态缩放移动输入框 */
|
|
8
|
-
export class LibPixiInput extends LibPixiContainer {
|
|
9
|
-
constructor(params) {
|
|
10
|
-
const { width, height, bgColor, value = "" } = params;
|
|
11
|
-
super(width, height, bgColor);
|
|
12
|
-
/** 当前输入的值 */
|
|
13
|
-
this._value = "";
|
|
14
|
-
/** @description 失去焦点处理 */
|
|
15
|
-
this._onBlurHandler = () => {
|
|
16
|
-
const { type = "text", integer = false, min = 1, max = Infinity, } = this._params;
|
|
17
|
-
let text = this._input.value.trim();
|
|
18
|
-
//如果类型为字符串,则不参与校验
|
|
19
|
-
if (type === "text")
|
|
20
|
-
return text;
|
|
21
|
-
//如果为空,则使用最小值
|
|
22
|
-
if (this._input.value === "")
|
|
23
|
-
text = min.toString();
|
|
24
|
-
//如果不能为负数,输入值小于最小值,则使用最小值
|
|
25
|
-
if (Number(text) < min)
|
|
26
|
-
text = min.toString();
|
|
27
|
-
//如果存在最大值,且输入值大于最大值,则使用最大值
|
|
28
|
-
if (max && Number(text) > max)
|
|
29
|
-
text = max.toString();
|
|
30
|
-
//如果要求整数,则取整
|
|
31
|
-
if (integer)
|
|
32
|
-
text = parseInt(text).toString();
|
|
33
|
-
//保留两位小数且不四舍五入
|
|
34
|
-
const value = new Decimal(Number(text));
|
|
35
|
-
text = value.toFixed(2, Decimal.ROUND_DOWN);
|
|
36
|
-
return text;
|
|
37
|
-
};
|
|
38
|
-
this.cursor = "text";
|
|
39
|
-
this._params = params;
|
|
40
|
-
this._value = value;
|
|
41
|
-
this._createInput();
|
|
42
|
-
this._createReadOnlyInput();
|
|
43
|
-
//聚焦
|
|
44
|
-
libPixiEvent(this, "pointertap", this._focus.bind(this));
|
|
45
|
-
const ticker = new Ticker();
|
|
46
|
-
ticker.add(() => {
|
|
47
|
-
if (this.destroyed) {
|
|
48
|
-
ticker.stop();
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
this._updateInputPosition();
|
|
52
|
-
});
|
|
53
|
-
ticker.start();
|
|
54
|
-
}
|
|
55
|
-
/** @description 设置值 */
|
|
56
|
-
setValue(v) {
|
|
57
|
-
const { onFormatValue } = this._params;
|
|
58
|
-
const value = v;
|
|
59
|
-
this._value = value;
|
|
60
|
-
this._readonlyInput.text = (onFormatValue === null || onFormatValue === void 0 ? void 0 : onFormatValue(value)) || value;
|
|
61
|
-
}
|
|
62
|
-
/** @description 创建输入框 */
|
|
63
|
-
_createInput() {
|
|
64
|
-
const { color = "#fff", maxLength = 999999, align = "left", type = "text", onInput = () => { }, fontFamily = "", bold = false, } = this._params;
|
|
65
|
-
this._input = document.createElement("input");
|
|
66
|
-
this._input.type = type;
|
|
67
|
-
this._input.maxLength = maxLength;
|
|
68
|
-
this._input.style.cssText = `
|
|
69
|
-
position: absolute;
|
|
70
|
-
border: none;
|
|
71
|
-
outline: none;
|
|
72
|
-
display: none;
|
|
73
|
-
background-color: transparent;
|
|
74
|
-
color: ${color};
|
|
75
|
-
text-align: ${align};
|
|
76
|
-
font-family: ${fontFamily};
|
|
77
|
-
font-bold: ${bold ? "bold" : "normal"}
|
|
78
|
-
`;
|
|
79
|
-
document.querySelector("#game").appendChild(this._input);
|
|
80
|
-
this._input.addEventListener("input", function () {
|
|
81
|
-
if (this.value.length > maxLength && type === "number") {
|
|
82
|
-
this.value = this.value.slice(0, maxLength);
|
|
83
|
-
}
|
|
84
|
-
onInput(this.value.trim());
|
|
85
|
-
});
|
|
86
|
-
this._input.addEventListener("paste", function (e) {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
const paste = (_b = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
|
|
89
|
-
if (paste.length > maxLength) {
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
this.value = paste.slice(0, maxLength);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
this._input.addEventListener("blur", this._blur.bind(this));
|
|
95
|
-
}
|
|
96
|
-
/** @description 创建只读输入框 */
|
|
97
|
-
_createReadOnlyInput() {
|
|
98
|
-
const { color = "#fff", value = "", width, height, fontSizeRatio = 0.5, align = "left", placeholder = "", placeholderColor, fontFamily = "", bold = false, } = this._params;
|
|
99
|
-
//创建描述
|
|
100
|
-
this._placeholder = new LibPixiText({
|
|
101
|
-
text: placeholder,
|
|
102
|
-
fontColor: placeholderColor,
|
|
103
|
-
fontSize: height * fontSizeRatio,
|
|
104
|
-
fontFamily,
|
|
105
|
-
fontWeight: bold ? "bold" : "normal",
|
|
106
|
-
});
|
|
107
|
-
this.addChild(this._placeholder);
|
|
108
|
-
this._placeholder.visible = !value;
|
|
109
|
-
this._placeholder.anchor.set(align === "left" ? 0 : 0.5, 0.5);
|
|
110
|
-
this._placeholder.position.set(align === "left" ? 0 : width / 2, height / 2);
|
|
111
|
-
//创建实际显示的文本
|
|
112
|
-
this._readonlyInput = new LibPixiText({
|
|
113
|
-
text: value,
|
|
114
|
-
fontColor: color,
|
|
115
|
-
fontSize: height * fontSizeRatio,
|
|
116
|
-
fontFamily,
|
|
117
|
-
fontWeight: bold ? "bold" : "normal",
|
|
118
|
-
});
|
|
119
|
-
this.addChild(this._readonlyInput);
|
|
120
|
-
this._readonlyInput.visible = !!value;
|
|
121
|
-
this._readonlyInput.anchor.set(align === "left" ? 0 : 0.5, 0.5);
|
|
122
|
-
this._readonlyInput.position.set(align === "left" ? 0 : width / 2, height / 2);
|
|
123
|
-
}
|
|
124
|
-
/** @description 聚焦 */
|
|
125
|
-
_focus() {
|
|
126
|
-
const { type } = this._params;
|
|
127
|
-
this._input.style.display = "block";
|
|
128
|
-
this._input.focus();
|
|
129
|
-
this._readonlyInput.visible = false;
|
|
130
|
-
this._placeholder.visible = false;
|
|
131
|
-
if (type === "number") {
|
|
132
|
-
this._input.value = this._value && Number(this._value).toString();
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this._input.value = this._value;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/** @description 失焦 */
|
|
139
|
-
_blur() {
|
|
140
|
-
const { onValue, width } = this._params;
|
|
141
|
-
const value = this._onBlurHandler();
|
|
142
|
-
this.setValue(value);
|
|
143
|
-
this._input.style.display = "none";
|
|
144
|
-
libPixiScaleContainer(this._readonlyInput, width);
|
|
145
|
-
if (this._params.type === "number") {
|
|
146
|
-
this._readonlyInput.visible = true;
|
|
147
|
-
onValue === null || onValue === void 0 ? void 0 : onValue(Number(value));
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
onValue === null || onValue === void 0 ? void 0 : onValue(value);
|
|
151
|
-
//如果输入的值为空,并且启用了描述,并且没有默认值,则显示描述
|
|
152
|
-
if (value === "" && this._placeholder) {
|
|
153
|
-
this._placeholder.visible = true;
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
this._readonlyInput.visible = true;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/** @description 实时更新输入框位置 */
|
|
161
|
-
_updateInputPosition() {
|
|
162
|
-
const { width, height, x, y } = this.getBounds();
|
|
163
|
-
const { fontSizeRatio = 0.5 } = this._params;
|
|
164
|
-
this._input.style.width = `${width}px`;
|
|
165
|
-
this._input.style.height = `${height}px`;
|
|
166
|
-
this._input.style.fontSize = `${height * fontSizeRatio}px`;
|
|
167
|
-
if (LibPixiInput.stage.rotation === 0) {
|
|
168
|
-
this._input.style.left = `${x}px`;
|
|
169
|
-
this._input.style.top = `${y}px`;
|
|
170
|
-
this._input.style.width = `${width}px`;
|
|
171
|
-
this._input.style.height = `${height}px`;
|
|
172
|
-
this._input.style.fontSize = `${height * fontSizeRatio}px`;
|
|
173
|
-
this._input.style.transform = `rotate(0deg)`;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
const centerX = x + width / 2;
|
|
177
|
-
const centerY = y + height / 2;
|
|
178
|
-
this._input.style.left = `${centerX - height / 2}px`;
|
|
179
|
-
this._input.style.top = `${centerY - width / 2}px`;
|
|
180
|
-
this._input.style.width = `${height}px`;
|
|
181
|
-
this._input.style.height = `${width}px`;
|
|
182
|
-
this._input.style.fontSize = `${width * fontSizeRatio}px`;
|
|
183
|
-
this._input.style.transform = `rotate(90deg)`;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BitmapText, Container, Sprite } from "pixi.js";
|
|
2
|
-
import { LibPixiText } from "../Base/LibPixiText";
|
|
3
|
-
type T = Sprite | LibPixiText | BitmapText;
|
|
4
|
-
interface LabelValueParams {
|
|
5
|
-
/** 描述 */
|
|
6
|
-
label: T;
|
|
7
|
-
/** 值 */
|
|
8
|
-
value: T;
|
|
9
|
-
/** 最大宽度 */
|
|
10
|
-
maxWidth?: number;
|
|
11
|
-
/** 间隔 */
|
|
12
|
-
gap?: number;
|
|
13
|
-
}
|
|
14
|
-
/** @description 自适应宽度的标签和值组件
|
|
15
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
|
|
16
|
-
*/
|
|
17
|
-
export declare class LibPixiLabelValue extends Container {
|
|
18
|
-
/** 描述 */
|
|
19
|
-
private _label;
|
|
20
|
-
/** 值 */
|
|
21
|
-
private _value;
|
|
22
|
-
/** 间隔 */
|
|
23
|
-
private _gap;
|
|
24
|
-
/** 最大宽度 */
|
|
25
|
-
private _maxWidth?;
|
|
26
|
-
constructor(params: LabelValueParams);
|
|
27
|
-
/** @description 更新坐标 */
|
|
28
|
-
updatePosition(): void;
|
|
29
|
-
}
|
|
30
|
-
export {};
|