lyb-pixi-js 1.1.19 → 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.
- package/README.md +17 -5
- package/package.json +1 -1
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
|
-
|
|
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-溢出裁剪
|