lyb-pixi-js 1.9.19 → 1.10.1

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 CHANGED
@@ -166,6 +166,8 @@ app.stage.addChild(box);
166
166
 
167
167
  \- [LibPixiArrangeLinear-间隔布局](#LibPixiArrangeLinear-间隔布局)
168
168
 
169
+ \- [LibPixiEmitContainerEvent-触发后代监听](#LibPixiEmitContainerEvent-触发后代监听)
170
+
169
171
  ## Base-基础
170
172
 
171
173
  ### LibPixiText-文本
@@ -1198,3 +1200,11 @@ LibPixiGridLayout(cardList, 20, 3); //间隔20,一行三个
1198
1200
  LibPixiArrangeLinear(cardList, 20, "y"); //间隔20,y轴排列
1199
1201
  ```
1200
1202
 
1203
+ ### LibPixiEmitContainerEvent-触发后代监听
1204
+
1205
+ > 递归调用后代的事件发射器
1206
+
1207
+ ```ts
1208
+ LibPixiEmitContainerEvent(this, "EVENT_NAME", {})
1209
+ ```
1210
+
@@ -0,0 +1,7 @@
1
+ import { Container } from "pixi.js";
2
+ /** @description 触发后代监听
3
+ * @param container 容器
4
+ * @param event 事件名称
5
+ * @param payload 事件携带数据
6
+ */
7
+ export declare const LibEmitContainerEvent: (container: Container, event: string, payload?: any) => void;
@@ -0,0 +1,13 @@
1
+ /** @description 触发后代监听
2
+ * @param container 容器
3
+ * @param event 事件名称
4
+ * @param payload 事件携带数据
5
+ */
6
+ export const LibEmitContainerEvent = (container, event, payload) => {
7
+ container.children.forEach((child) => {
8
+ child.emit(event, payload);
9
+ if ("children" in child) {
10
+ LibEmitContainerEvent(child, event, payload);
11
+ }
12
+ });
13
+ };
@@ -0,0 +1,7 @@
1
+ import { Container } from "pixi.js";
2
+ /** @description 触发后代监听
3
+ * @param container 容器
4
+ * @param event 事件名称
5
+ * @param payload 事件携带数据
6
+ */
7
+ export declare const LibPixiEmitContainerEvent: (container: Container, event: string, payload?: any) => void;
@@ -0,0 +1,13 @@
1
+ /** @description 触发后代监听
2
+ * @param container 容器
3
+ * @param event 事件名称
4
+ * @param payload 事件携带数据
5
+ */
6
+ export const LibPixiEmitContainerEvent = (container, event, payload) => {
7
+ container.children.forEach((child) => {
8
+ child.emit(event, payload);
9
+ if ("children" in child) {
10
+ LibPixiEmitContainerEvent(child, event, payload);
11
+ }
12
+ });
13
+ };
package/libPixiJs.d.ts CHANGED
@@ -225,4 +225,10 @@ export declare const Utils: {
225
225
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiArrangeLinear-间隔布局
226
226
  */
227
227
  LibPixiArrangeLinear: (items: import("pixi.js").Container[], gap: number | number[], direction?: "x" | "y") => void;
228
+ /** @description 触发后代监听
229
+ * @param container 容器
230
+ * @param event 事件名称
231
+ * @param payload 事件携带数据
232
+ */
233
+ LibPixiEmitContainerEvent: (container: import("pixi.js").Container, event: string, payload?: any) => void;
228
234
  };
package/libPixiJs.js CHANGED
@@ -38,6 +38,7 @@ import { LibPixiDownScaleAnimation } from "./Utils/LibPixiDownScaleAnimation";
38
38
  import { LibPixiGridLayout } from "./Utils/LibPixiGridLayout";
39
39
  import { LibPixiArrangeLinear } from "./Utils/LibPixiArrangeLinear";
40
40
  import { LibPixiSlide } from "./Components/Custom/LibPixiSlide";
41
+ import { LibPixiEmitContainerEvent } from "./Utils/LibPixiEmitContainerEvent";
41
42
  /** @description 组件 */
42
43
  export const Components = {
43
44
  Base: {
@@ -239,4 +240,10 @@ export const Utils = {
239
240
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiArrangeLinear-间隔布局
240
241
  */
241
242
  LibPixiArrangeLinear,
243
+ /** @description 触发后代监听
244
+ * @param container 容器
245
+ * @param event 事件名称
246
+ * @param payload 事件携带数据
247
+ */
248
+ LibPixiEmitContainerEvent,
242
249
  };
package/lyb-pixi.js CHANGED
@@ -55379,6 +55379,14 @@ void main(void){
55379
55379
  }
55380
55380
  }
55381
55381
  }
55382
+ const LibPixiEmitContainerEvent = (container, event, payload) => {
55383
+ container.children.forEach((child) => {
55384
+ child.emit(event, payload);
55385
+ if ("children" in child) {
55386
+ LibPixiEmitContainerEvent(child, event, payload);
55387
+ }
55388
+ });
55389
+ };
55382
55390
  const Components = {
55383
55391
  Base: {
55384
55392
  /** @description 自定义位图文本
@@ -55577,7 +55585,13 @@ void main(void){
55577
55585
  * @param direction 排列方向,"x"表示水平,"y"表示垂直,默认为水平。
55578
55586
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiArrangeLinear-间隔布局
55579
55587
  */
55580
- LibPixiArrangeLinear
55588
+ LibPixiArrangeLinear,
55589
+ /** @description 触发后代监听
55590
+ * @param container 容器
55591
+ * @param event 事件名称
55592
+ * @param payload 事件携带数据
55593
+ */
55594
+ LibPixiEmitContainerEvent
55581
55595
  };
55582
55596
  const LibPixiJs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
55583
55597
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.9.19",
3
+ "version": "1.10.1",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {