lyb-pixi-js 1.12.33 → 1.12.35
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/Base/LibPixiArc.d.ts +16 -0
- package/Components/Base/LibPixiArc.js +14 -0
- package/Components/Base/LibPixiBitText.d.ts +20 -0
- package/Components/Base/LibPixiBitText.js +26 -0
- package/Components/Base/LibPixiCircular.d.ts +7 -0
- package/Components/Base/LibPixiCircular.js +12 -0
- package/Components/Base/LibPixiContainer.d.ts +22 -0
- package/Components/Base/LibPixiContainer.js +51 -0
- package/Components/Base/LibPixiHtmlText.d.ts +31 -0
- package/Components/Base/LibPixiHtmlText.js +30 -0
- package/Components/Base/LibPixiOval.d.ts +5 -0
- package/Components/Base/LibPixiOval.js +10 -0
- package/Components/Base/LibPixiParticleMove.d.ts +101 -0
- package/Components/Base/LibPixiParticleMove.js +136 -0
- package/Components/Base/LibPixiPolygon.d.ts +7 -0
- package/Components/Base/LibPixiPolygon.js +15 -0
- package/Components/Base/LibPixiRectBgColor.d.ts +41 -0
- package/Components/Base/LibPixiRectBgColor.js +95 -0
- package/Components/Base/LibPixiRectangle.d.ts +7 -0
- package/Components/Base/LibPixiRectangle.js +15 -0
- package/Components/Base/LibPixiRound.d.ts +5 -0
- package/Components/Base/LibPixiRound.js +9 -0
- package/Components/Base/LibPixiRoundedRect.d.ts +5 -0
- package/Components/Base/LibPixiRoundedRect.js +10 -0
- package/Components/Base/LibPixiSpine.d.ts +58 -0
- package/Components/Base/LibPixiSpine.js +128 -0
- package/Components/Base/LibPixiText.d.ts +37 -0
- package/Components/Base/LibPixiText.js +35 -0
- package/Components/Custom/LibPixiAreaClick.d.ts +6 -0
- package/Components/Custom/LibPixiAreaClick.js +16 -0
- package/Components/Custom/LibPixiArrangeLinearV2.d.ts +25 -0
- package/Components/Custom/LibPixiArrangeLinearV2.js +80 -0
- package/Components/Custom/LibPixiButtonHover.d.ts +40 -0
- package/Components/Custom/LibPixiButtonHover.js +53 -0
- package/Components/Custom/LibPixiCapsule.d.ts +5 -0
- package/Components/Custom/LibPixiCapsule.js +10 -0
- package/Components/Custom/LibPixiCloseBtn.d.ts +14 -0
- package/Components/Custom/LibPixiCloseBtn.js +36 -0
- package/Components/Custom/LibPixiDragLocate.d.ts +36 -0
- package/Components/Custom/LibPixiDragLocate.js +230 -0
- package/Components/Custom/LibPixiDrawer.d.ts +16 -0
- package/Components/Custom/LibPixiDrawer.js +59 -0
- package/Components/Custom/LibPixiGridLayoutV2.d.ts +27 -0
- package/Components/Custom/LibPixiGridLayoutV2.js +37 -0
- package/Components/Custom/LibPixiHeadingParagraphLayout.d.ts +18 -0
- package/Components/Custom/LibPixiHeadingParagraphLayout.js +27 -0
- package/Components/Custom/LibPixiInput.d.ts +77 -0
- package/Components/Custom/LibPixiInput.js +198 -0
- package/Components/Custom/LibPixiLabelValue.d.ts +30 -0
- package/Components/Custom/LibPixiLabelValue.js +26 -0
- package/Components/Custom/LibPixiPerforMon.d.ts +47 -0
- package/Components/Custom/LibPixiPerforMon.js +166 -0
- package/Components/Custom/LibPixiProgress.d.ts +33 -0
- package/Components/Custom/LibPixiProgress.js +47 -0
- package/Components/Custom/LibPixiPuzzleBg.d.ts +7 -0
- package/Components/Custom/LibPixiPuzzleBg.js +46 -0
- package/Components/Custom/LibPixiScrollContainerX.d.ts +71 -0
- package/Components/Custom/LibPixiScrollContainerX.js +198 -0
- package/Components/Custom/LibPixiScrollContainerY.d.ts +109 -0
- package/Components/Custom/LibPixiScrollContainerY.js +340 -0
- package/Components/Custom/LibPixiScrollNum.d.ts +67 -0
- package/Components/Custom/LibPixiScrollNum.js +184 -0
- package/Components/Custom/LibPixiSlide.d.ts +94 -0
- package/Components/Custom/LibPixiSlide.js +285 -0
- package/Components/Custom/LibPixiSlider.d.ts +82 -0
- package/Components/Custom/LibPixiSlider.js +165 -0
- package/Components/Custom/LibPixiTable.d.ts +64 -0
- package/Components/Custom/LibPixiTable.js +76 -0
- package/Components/Custom/LibPixiTextGroupWrap.d.ts +20 -0
- package/Components/Custom/LibPixiTextGroupWrap.js +50 -0
- package/Components/Custom/LibPixiTriangle.d.ts +5 -0
- package/Components/Custom/LibPixiTriangle.js +12 -0
- package/Components/Custom/LibPixiTurntable.d.ts +6 -0
- package/Components/Custom/LibPixiTurntable.js +14 -0
- package/README.md +6 -0
- package/Utils/LibContainerCenter.d.ts +3 -0
- package/Utils/LibContainerCenter.js +10 -0
- package/Utils/LibControlledDelayedCall.d.ts +5 -0
- package/Utils/LibControlledDelayedCall.js +20 -0
- package/Utils/LibPixiArrangeLinear.d.ts +16 -0
- package/Utils/LibPixiArrangeLinear.js +62 -0
- package/Utils/LibPixiAudio.d.ts +53 -0
- package/Utils/LibPixiAudio.js +168 -0
- package/Utils/LibPixiCreateNineGrid.d.ts +15 -0
- package/Utils/LibPixiCreateNineGrid.js +19 -0
- package/Utils/LibPixiDialogManager/index.d.ts +25 -0
- package/Utils/LibPixiDialogManager/index.js +43 -0
- package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.d.ts +11 -0
- package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.js +31 -0
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.d.ts +38 -0
- package/Utils/LibPixiDialogManager/ui/LibPixiDialog.js +134 -0
- package/Utils/LibPixiDigitalIncreasingAnimation.d.ts +18 -0
- package/Utils/LibPixiDigitalIncreasingAnimation.js +26 -0
- package/Utils/LibPixiDownScaleAnimation.d.ts +7 -0
- package/Utils/LibPixiDownScaleAnimation.js +33 -0
- package/Utils/LibPixiEmitContainerEvent.d.ts +7 -0
- package/Utils/LibPixiEmitContainerEvent.js +13 -0
- package/Utils/LibPixiEvent.d.ts +19 -0
- package/Utils/LibPixiEvent.js +68 -0
- package/Utils/LibPixiFilter.d.ts +9 -0
- package/Utils/LibPixiFilter.js +34 -0
- package/Utils/LibPixiGlobalUpdater.d.ts +15 -0
- package/Utils/LibPixiGlobalUpdater.js +21 -0
- package/Utils/LibPixiGridLayout.d.ts +10 -0
- package/Utils/LibPixiGridLayout.js +27 -0
- package/Utils/LibPixiHVCenter.d.ts +7 -0
- package/Utils/LibPixiHVCenter.js +14 -0
- package/Utils/LibPixiHVGap.d.ts +8 -0
- package/Utils/LibPixiHVGap.js +26 -0
- package/Utils/LibPixiIntervalTrigger.d.ts +7 -0
- package/Utils/LibPixiIntervalTrigger.js +35 -0
- package/Utils/LibPixiOutsideClick.d.ts +8 -0
- package/Utils/LibPixiOutsideClick.js +22 -0
- package/Utils/LibPixiOverflowHidden.d.ts +6 -0
- package/Utils/LibPixiOverflowHidden.js +14 -0
- package/Utils/LibPixiPolygonDrawTool.d.ts +44 -0
- package/Utils/LibPixiPolygonDrawTool.js +114 -0
- package/Utils/LibPixiPromiseTickerTimeout.d.ts +6 -0
- package/Utils/LibPixiPromiseTickerTimeout.js +22 -0
- package/Utils/LibPixiScaleContainer.d.ts +8 -0
- package/Utils/LibPixiScaleContainer.js +14 -0
- package/Utils/LibPixiShadow.d.ts +17 -0
- package/Utils/LibPixiShadow.js +18 -0
- package/Utils/LibPixiSlideInput.d.ts +55 -0
- package/Utils/LibPixiSlideInput.js +61 -0
- package/Utils/LibPixiTicker.d.ts +14 -0
- package/Utils/LibPixiTicker.js +49 -0
- package/Utils/LibPixiTickerTimeout.d.ts +6 -0
- package/Utils/LibPixiTickerTimeout.js +22 -0
- package/package.json +1 -2
- package/index.js +0 -5
- package/lyb-pixi.js +0 -58890
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { libPixiEvent } from "./LibPixiEvent";
|
|
2
|
+
/** @description 滑动选择器核心代码
|
|
3
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSlideInput-滑动选择值
|
|
4
|
+
*/
|
|
5
|
+
export class LibPixiSlideInput {
|
|
6
|
+
constructor(params) {
|
|
7
|
+
/** 是否处于拖动中 */
|
|
8
|
+
this._isDragging = false;
|
|
9
|
+
/** 当前移动的位置 */
|
|
10
|
+
this._moveX = 0;
|
|
11
|
+
/** 上次移动的位置 */
|
|
12
|
+
this._lastMoveX = 0;
|
|
13
|
+
/** 当前进度 */
|
|
14
|
+
this._progress = 0;
|
|
15
|
+
const { app, clickArea, maxMoveDistance, onChange, onDown, onUp, sideArea, } = params;
|
|
16
|
+
this._app = app;
|
|
17
|
+
this._maxMoveDistance = maxMoveDistance;
|
|
18
|
+
this._onChange = onChange;
|
|
19
|
+
this._onDown = onDown;
|
|
20
|
+
this._onUp = onUp;
|
|
21
|
+
this._sideArea = sideArea;
|
|
22
|
+
clickArea.forEach((item) => {
|
|
23
|
+
libPixiEvent(item, "pointerdown", this._onDragStart.bind(this));
|
|
24
|
+
});
|
|
25
|
+
libPixiEvent(sideArea, "pointerdown", this._onDragMove.bind(this));
|
|
26
|
+
app.stage.on("pointermove", this._onDragMove.bind(this));
|
|
27
|
+
app.stage.on("pointerup", this._onDragEnd.bind(this));
|
|
28
|
+
}
|
|
29
|
+
/** @description 设置进度
|
|
30
|
+
* @param value 进度值,范围 0-1
|
|
31
|
+
*/
|
|
32
|
+
setValue(value) {
|
|
33
|
+
this._progress = value;
|
|
34
|
+
this._lastMoveX = this._maxMoveDistance * value;
|
|
35
|
+
this._onChange(this._lastMoveX, value);
|
|
36
|
+
}
|
|
37
|
+
/** @description 按下触发 */
|
|
38
|
+
_onDragStart() {
|
|
39
|
+
var _a;
|
|
40
|
+
this._app.stage.eventMode = "static";
|
|
41
|
+
this._isDragging = true;
|
|
42
|
+
(_a = this._onDown) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
43
|
+
}
|
|
44
|
+
/** @description 移动触发 */
|
|
45
|
+
_onDragMove(event) {
|
|
46
|
+
const position = event.getLocalPosition(this._sideArea);
|
|
47
|
+
if (this._isDragging) {
|
|
48
|
+
this._moveX = Math.max(0, Math.min(position.x, this._maxMoveDistance));
|
|
49
|
+
this._progress = Number((this._moveX / this._maxMoveDistance).toFixed(2));
|
|
50
|
+
this._onChange(this._moveX, this._progress);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** @description 抬起触发 */
|
|
54
|
+
_onDragEnd() {
|
|
55
|
+
var _a;
|
|
56
|
+
this._app.stage.eventMode = "auto";
|
|
57
|
+
this._isDragging = false;
|
|
58
|
+
this._lastMoveX = this._moveX;
|
|
59
|
+
(_a = this._onUp) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @description Ticker管理器 */
|
|
2
|
+
export declare class LibPixiTicker {
|
|
3
|
+
private static _callbacks;
|
|
4
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
5
|
+
static add(id: string, fn: () => void): () => void;
|
|
6
|
+
/** @description 删除回调 */
|
|
7
|
+
static remove(id: string): void;
|
|
8
|
+
/** @description 停止某个回调(pause) */
|
|
9
|
+
static stop(id: string): void;
|
|
10
|
+
/** @description 启动某个回调(resume) */
|
|
11
|
+
static start(id: string): void;
|
|
12
|
+
/** @description 清空所有回调 */
|
|
13
|
+
static clearAll(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Ticker } from "pixi.js";
|
|
2
|
+
/** @description Ticker管理器 */
|
|
3
|
+
export class LibPixiTicker {
|
|
4
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
5
|
+
static add(id, fn) {
|
|
6
|
+
// 如果已有相同 ID,先移除旧回调
|
|
7
|
+
if (this._callbacks.has(id)) {
|
|
8
|
+
Ticker.shared.remove(this._callbacks.get(id).fn);
|
|
9
|
+
}
|
|
10
|
+
// 默认 active
|
|
11
|
+
this._callbacks.set(id, { fn, active: true });
|
|
12
|
+
Ticker.shared.add(fn);
|
|
13
|
+
return () => {
|
|
14
|
+
LibPixiTicker.remove(id);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** @description 删除回调 */
|
|
18
|
+
static remove(id) {
|
|
19
|
+
const cb = this._callbacks.get(id);
|
|
20
|
+
if (cb) {
|
|
21
|
+
Ticker.shared.remove(cb.fn);
|
|
22
|
+
this._callbacks.delete(id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** @description 停止某个回调(pause) */
|
|
26
|
+
static stop(id) {
|
|
27
|
+
const cb = this._callbacks.get(id);
|
|
28
|
+
if (cb && cb.active) {
|
|
29
|
+
Ticker.shared.remove(cb.fn);
|
|
30
|
+
cb.active = false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** @description 启动某个回调(resume) */
|
|
34
|
+
static start(id) {
|
|
35
|
+
const cb = this._callbacks.get(id);
|
|
36
|
+
if (cb && !cb.active) {
|
|
37
|
+
Ticker.shared.add(cb.fn);
|
|
38
|
+
cb.active = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** @description 清空所有回调 */
|
|
42
|
+
static clearAll() {
|
|
43
|
+
this._callbacks.forEach((cb) => {
|
|
44
|
+
Ticker.shared.remove(cb.fn);
|
|
45
|
+
});
|
|
46
|
+
this._callbacks.clear();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
LibPixiTicker._callbacks = new Map();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** @description 基于 Ticker 的定时器
|
|
2
|
+
* @param callback 延迟后执行的函数
|
|
3
|
+
* @param delay 延迟时间
|
|
4
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiTickerTimeout-Ticker定时器
|
|
5
|
+
*/
|
|
6
|
+
export declare const libPixiTickerTimeout: (callback: () => void, delay?: number) => () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Ticker } from "pixi.js";
|
|
2
|
+
/** @description 基于 Ticker 的定时器
|
|
3
|
+
* @param callback 延迟后执行的函数
|
|
4
|
+
* @param delay 延迟时间
|
|
5
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiTickerTimeout-Ticker定时器
|
|
6
|
+
*/
|
|
7
|
+
export const libPixiTickerTimeout = (callback, delay = 1) => {
|
|
8
|
+
let elapsedTime = 0;
|
|
9
|
+
const ticker = Ticker.shared;
|
|
10
|
+
const tickerCallback = () => {
|
|
11
|
+
elapsedTime += ticker.deltaMS;
|
|
12
|
+
if (elapsedTime >= delay) {
|
|
13
|
+
callback === null || callback === void 0 ? void 0 : callback();
|
|
14
|
+
ticker.remove(tickerCallback);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
ticker.add(tickerCallback);
|
|
18
|
+
ticker.start();
|
|
19
|
+
return () => {
|
|
20
|
+
ticker.remove(tickerCallback);
|
|
21
|
+
};
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lyb-pixi-js",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.35",
|
|
4
4
|
"description": "自用Pixi.JS方法库",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./index.js",
|
|
8
7
|
"./Components/Base/*": "./Components/Base/*",
|
|
9
8
|
"./Components/Custom/*": "./Components/Custom/*",
|
|
10
9
|
"./Utils/*": "./Utils/*"
|