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.
Files changed (132) hide show
  1. package/Components/Base/LibPixiArc.d.ts +16 -0
  2. package/Components/Base/LibPixiArc.js +14 -0
  3. package/Components/Base/LibPixiBitText.d.ts +20 -0
  4. package/Components/Base/LibPixiBitText.js +26 -0
  5. package/Components/Base/LibPixiCircular.d.ts +7 -0
  6. package/Components/Base/LibPixiCircular.js +12 -0
  7. package/Components/Base/LibPixiContainer.d.ts +22 -0
  8. package/Components/Base/LibPixiContainer.js +51 -0
  9. package/Components/Base/LibPixiHtmlText.d.ts +31 -0
  10. package/Components/Base/LibPixiHtmlText.js +30 -0
  11. package/Components/Base/LibPixiOval.d.ts +5 -0
  12. package/Components/Base/LibPixiOval.js +10 -0
  13. package/Components/Base/LibPixiParticleMove.d.ts +101 -0
  14. package/Components/Base/LibPixiParticleMove.js +136 -0
  15. package/Components/Base/LibPixiPolygon.d.ts +7 -0
  16. package/Components/Base/LibPixiPolygon.js +15 -0
  17. package/Components/Base/LibPixiRectBgColor.d.ts +41 -0
  18. package/Components/Base/LibPixiRectBgColor.js +95 -0
  19. package/Components/Base/LibPixiRectangle.d.ts +7 -0
  20. package/Components/Base/LibPixiRectangle.js +15 -0
  21. package/Components/Base/LibPixiRound.d.ts +5 -0
  22. package/Components/Base/LibPixiRound.js +9 -0
  23. package/Components/Base/LibPixiRoundedRect.d.ts +5 -0
  24. package/Components/Base/LibPixiRoundedRect.js +10 -0
  25. package/Components/Base/LibPixiSpine.d.ts +58 -0
  26. package/Components/Base/LibPixiSpine.js +128 -0
  27. package/Components/Base/LibPixiText.d.ts +37 -0
  28. package/Components/Base/LibPixiText.js +35 -0
  29. package/Components/Custom/LibPixiAreaClick.d.ts +6 -0
  30. package/Components/Custom/LibPixiAreaClick.js +16 -0
  31. package/Components/Custom/LibPixiArrangeLinearV2.d.ts +25 -0
  32. package/Components/Custom/LibPixiArrangeLinearV2.js +80 -0
  33. package/Components/Custom/LibPixiButtonHover.d.ts +40 -0
  34. package/Components/Custom/LibPixiButtonHover.js +53 -0
  35. package/Components/Custom/LibPixiCapsule.d.ts +5 -0
  36. package/Components/Custom/LibPixiCapsule.js +10 -0
  37. package/Components/Custom/LibPixiCloseBtn.d.ts +14 -0
  38. package/Components/Custom/LibPixiCloseBtn.js +36 -0
  39. package/Components/Custom/LibPixiDragLocate.d.ts +36 -0
  40. package/Components/Custom/LibPixiDragLocate.js +230 -0
  41. package/Components/Custom/LibPixiDrawer.d.ts +16 -0
  42. package/Components/Custom/LibPixiDrawer.js +59 -0
  43. package/Components/Custom/LibPixiGridLayoutV2.d.ts +27 -0
  44. package/Components/Custom/LibPixiGridLayoutV2.js +37 -0
  45. package/Components/Custom/LibPixiHeadingParagraphLayout.d.ts +18 -0
  46. package/Components/Custom/LibPixiHeadingParagraphLayout.js +27 -0
  47. package/Components/Custom/LibPixiInput.d.ts +77 -0
  48. package/Components/Custom/LibPixiInput.js +198 -0
  49. package/Components/Custom/LibPixiLabelValue.d.ts +30 -0
  50. package/Components/Custom/LibPixiLabelValue.js +26 -0
  51. package/Components/Custom/LibPixiPerforMon.d.ts +47 -0
  52. package/Components/Custom/LibPixiPerforMon.js +166 -0
  53. package/Components/Custom/LibPixiProgress.d.ts +33 -0
  54. package/Components/Custom/LibPixiProgress.js +47 -0
  55. package/Components/Custom/LibPixiPuzzleBg.d.ts +7 -0
  56. package/Components/Custom/LibPixiPuzzleBg.js +46 -0
  57. package/Components/Custom/LibPixiScrollContainerX.d.ts +71 -0
  58. package/Components/Custom/LibPixiScrollContainerX.js +198 -0
  59. package/Components/Custom/LibPixiScrollContainerY.d.ts +109 -0
  60. package/Components/Custom/LibPixiScrollContainerY.js +340 -0
  61. package/Components/Custom/LibPixiScrollNum.d.ts +67 -0
  62. package/Components/Custom/LibPixiScrollNum.js +184 -0
  63. package/Components/Custom/LibPixiSlide.d.ts +94 -0
  64. package/Components/Custom/LibPixiSlide.js +285 -0
  65. package/Components/Custom/LibPixiSlider.d.ts +82 -0
  66. package/Components/Custom/LibPixiSlider.js +165 -0
  67. package/Components/Custom/LibPixiTable.d.ts +64 -0
  68. package/Components/Custom/LibPixiTable.js +76 -0
  69. package/Components/Custom/LibPixiTextGroupWrap.d.ts +20 -0
  70. package/Components/Custom/LibPixiTextGroupWrap.js +50 -0
  71. package/Components/Custom/LibPixiTriangle.d.ts +5 -0
  72. package/Components/Custom/LibPixiTriangle.js +12 -0
  73. package/Components/Custom/LibPixiTurntable.d.ts +6 -0
  74. package/Components/Custom/LibPixiTurntable.js +14 -0
  75. package/README.md +6 -0
  76. package/Utils/LibContainerCenter.d.ts +3 -0
  77. package/Utils/LibContainerCenter.js +10 -0
  78. package/Utils/LibControlledDelayedCall.d.ts +5 -0
  79. package/Utils/LibControlledDelayedCall.js +20 -0
  80. package/Utils/LibPixiArrangeLinear.d.ts +16 -0
  81. package/Utils/LibPixiArrangeLinear.js +62 -0
  82. package/Utils/LibPixiAudio.d.ts +53 -0
  83. package/Utils/LibPixiAudio.js +168 -0
  84. package/Utils/LibPixiCreateNineGrid.d.ts +15 -0
  85. package/Utils/LibPixiCreateNineGrid.js +19 -0
  86. package/Utils/LibPixiDialogManager/index.d.ts +25 -0
  87. package/Utils/LibPixiDialogManager/index.js +43 -0
  88. package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.d.ts +11 -0
  89. package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.js +31 -0
  90. package/Utils/LibPixiDialogManager/ui/LibPixiDialog.d.ts +38 -0
  91. package/Utils/LibPixiDialogManager/ui/LibPixiDialog.js +134 -0
  92. package/Utils/LibPixiDigitalIncreasingAnimation.d.ts +18 -0
  93. package/Utils/LibPixiDigitalIncreasingAnimation.js +26 -0
  94. package/Utils/LibPixiDownScaleAnimation.d.ts +7 -0
  95. package/Utils/LibPixiDownScaleAnimation.js +33 -0
  96. package/Utils/LibPixiEmitContainerEvent.d.ts +7 -0
  97. package/Utils/LibPixiEmitContainerEvent.js +13 -0
  98. package/Utils/LibPixiEvent.d.ts +19 -0
  99. package/Utils/LibPixiEvent.js +68 -0
  100. package/Utils/LibPixiFilter.d.ts +9 -0
  101. package/Utils/LibPixiFilter.js +34 -0
  102. package/Utils/LibPixiGlobalUpdater.d.ts +15 -0
  103. package/Utils/LibPixiGlobalUpdater.js +21 -0
  104. package/Utils/LibPixiGridLayout.d.ts +10 -0
  105. package/Utils/LibPixiGridLayout.js +27 -0
  106. package/Utils/LibPixiHVCenter.d.ts +7 -0
  107. package/Utils/LibPixiHVCenter.js +14 -0
  108. package/Utils/LibPixiHVGap.d.ts +8 -0
  109. package/Utils/LibPixiHVGap.js +26 -0
  110. package/Utils/LibPixiIntervalTrigger.d.ts +7 -0
  111. package/Utils/LibPixiIntervalTrigger.js +35 -0
  112. package/Utils/LibPixiOutsideClick.d.ts +8 -0
  113. package/Utils/LibPixiOutsideClick.js +22 -0
  114. package/Utils/LibPixiOverflowHidden.d.ts +6 -0
  115. package/Utils/LibPixiOverflowHidden.js +14 -0
  116. package/Utils/LibPixiPolygonDrawTool.d.ts +44 -0
  117. package/Utils/LibPixiPolygonDrawTool.js +114 -0
  118. package/Utils/LibPixiPromiseTickerTimeout.d.ts +6 -0
  119. package/Utils/LibPixiPromiseTickerTimeout.js +22 -0
  120. package/Utils/LibPixiScaleContainer.d.ts +8 -0
  121. package/Utils/LibPixiScaleContainer.js +14 -0
  122. package/Utils/LibPixiShadow.d.ts +17 -0
  123. package/Utils/LibPixiShadow.js +18 -0
  124. package/Utils/LibPixiSlideInput.d.ts +55 -0
  125. package/Utils/LibPixiSlideInput.js +61 -0
  126. package/Utils/LibPixiTicker.d.ts +14 -0
  127. package/Utils/LibPixiTicker.js +49 -0
  128. package/Utils/LibPixiTickerTimeout.d.ts +6 -0
  129. package/Utils/LibPixiTickerTimeout.js +22 -0
  130. package/package.json +1 -2
  131. package/index.js +0 -5
  132. 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.33",
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/*"
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- (function(factory) {
2
- typeof define === "function" && define.amd ? define(factory) : factory();
3
- })(function() {
4
- "use strict";
5
- });