lyb-pixi-js 1.1.18 → 1.1.20

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.
@@ -1,5 +1,6 @@
1
1
  import { type Container } from "pixi.js";
2
2
  import { Spine } from "@pixi-spine/runtime-3.8";
3
+ import "pixi-spine";
3
4
  export interface OnUpdateParams {
4
5
  x: number;
5
6
  y: number;
@@ -1,6 +1,7 @@
1
1
  import { Assets, Ticker } from "pixi.js";
2
2
  import { Spine } from "@pixi-spine/runtime-3.8";
3
3
  import gsap from "gsap";
4
+ import "pixi-spine";
4
5
  /** @description 自定义 Spine 动画
5
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
6
7
  */
package/README.md CHANGED
@@ -652,12 +652,24 @@ stopInterval();
652
652
  > 点击容器外或入口按钮时隐藏
653
653
 
654
654
  ```ts
655
- const stopOutsideClick = libPixiOutsideClick(container, button, () => {
656
- console.log("Container closed");
657
- });
658
655
 
659
- //停止监听点击事件
660
- stopOutsideClick();
656
+ let removeEventListener: () => void;
657
+ const btn = new Sprite(Assets.get("btnIcon"));
658
+ const optionList = new Container();
659
+ libPixiEvent(btn, "pointertap", () => {
660
+ optionList.visible = !optionList.visible;
661
+
662
+ //列表显示后开始监听是否点击容器外
663
+ if (optionList.visible) {
664
+ removeEventListener = libPixiOutsideClick(optionList, btn, () => {
665
+ optionList.visible = false;
666
+ });
667
+ }
668
+ //如果通过再次点击按钮关闭了列表,则移除监听器
669
+ else {
670
+ removeEventListener();
671
+ }
672
+ });
661
673
  ```
662
674
 
663
675
  ### LibPixiOverflowHidden-溢出裁剪