lyb-pixi-js 1.12.67 → 1.12.69

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
@@ -152,7 +152,7 @@ app.stage.addChild(box);
152
152
 
153
153
  \- [LibPixiTextGroupWrap-文本组换行](#LibPixiTextGroupWrap-文本组换行)
154
154
 
155
- \- [LibPixiGridLayoutV2-网格布局V2](#LibPixiGridLayoutV2-网格布局V2)
155
+ \- [LibPixiGridLayoutV2-网格布局 V2](#LibPixiGridLayoutV2-网格布局V2)
156
156
 
157
157
  \- [LibPixiAreaClick-扩大点击范围](#LibPixiAreaClick-扩大点击范围)
158
158
 
@@ -196,12 +196,14 @@ app.stage.addChild(box);
196
196
 
197
197
  \- [LibPixiEmitContainerEvent-触发后代监听](#LibPixiEmitContainerEvent-触发后代监听)
198
198
 
199
- \- [LibPixiTicker-Ticker管理器](#LibPixiTicker-Ticker管理器)
199
+ \- [LibPixiTicker-Ticker 管理器](#LibPixiTicker-Ticker管理器)
200
200
 
201
201
  \- [LibPixiPivot-容器锚点设置](#LibPixiPivot-容器锚点设置)
202
202
 
203
203
  \- [LibPixiPivot-容器锚点设置](#libPixiLocalBoundary-本地边界坐标)
204
204
 
205
+ \- [LibPixiIsOutOfView-离开可视区检测](#LibPixiIsOutOfView-离开可视区检测)
206
+
205
207
  ## Base-基础
206
208
 
207
209
  ### LibPixiText-文本
@@ -1271,7 +1273,7 @@ LibPixiDownScaleAnimation(sprite);
1271
1273
  LibPixiEmitContainerEvent(this, "EVENT_NAME", {});
1272
1274
  ```
1273
1275
 
1274
- ### LibPixiTicker-Ticker管理器
1276
+ ### LibPixiTicker-Ticker 管理器
1275
1277
 
1276
1278
  > 添加和删除 `Ticker` 函数,单个 `Ticker` 函数暂停开始,所有 `Ticker` 函数使用的是全局的 `Ticker`
1277
1279
 
@@ -1281,4 +1283,8 @@ LibPixiEmitContainerEvent(this, "EVENT_NAME", {});
1281
1283
 
1282
1284
  ### LibPixiLocalBoundary-本地边界坐标
1283
1285
 
1284
- >
1286
+ >获取屏幕左上角和右上角在舞台上的位置
1287
+
1288
+ ### LibPixiIsOutOfView-离开可视区检测
1289
+
1290
+ > 检测元素是否离开可视区
@@ -4,4 +4,4 @@ import { Container } from "pixi.js";
4
4
  * @param type 缩放类型
5
5
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
6
6
  */
7
- export declare const LibPixiDownScaleAnimation: (container: Container, type?: "small" | "big") => void;
7
+ export declare const LibPixiDownScaleAnimation: (container: Container, type?: "small" | "big", scaleContainer?: Container) => void;
@@ -1,13 +1,13 @@
1
- import { libPixiEvent } from "./LibPixiEvent";
2
1
  import gsap from "gsap";
2
+ import { libPixiEvent } from "./LibPixiEvent";
3
3
  /** @description 按下放大
4
4
  * @param container 要放大的容器
5
5
  * @param type 缩放类型
6
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
7
7
  */
8
- export const LibPixiDownScaleAnimation = (container, type = "big") => {
8
+ export const LibPixiDownScaleAnimation = (container, type = "big", scaleContainer) => {
9
9
  libPixiEvent(container, "pointerdown", () => {
10
- gsap.to(container, {
10
+ gsap.to(scaleContainer || container, {
11
11
  duration: 0.1,
12
12
  pixi: {
13
13
  scale: type === "big" ? 1.1 : 0.9,
@@ -15,7 +15,7 @@ export const LibPixiDownScaleAnimation = (container, type = "big") => {
15
15
  });
16
16
  });
17
17
  libPixiEvent(container, "pointerup", () => {
18
- gsap.to(container, {
18
+ gsap.to(scaleContainer || container, {
19
19
  duration: 0.1,
20
20
  pixi: {
21
21
  scale: 1,
@@ -23,7 +23,7 @@ export const LibPixiDownScaleAnimation = (container, type = "big") => {
23
23
  });
24
24
  });
25
25
  libPixiEvent(container, "pointerleave", () => {
26
- gsap.to(container, {
26
+ gsap.to(scaleContainer || container, {
27
27
  duration: 0.1,
28
28
  pixi: {
29
29
  scale: 1,
@@ -0,0 +1,3 @@
1
+ import { Container } from "pixi.js";
2
+ /** @description 判断元素是否超出屏幕 */
3
+ export declare const libPixiIsOutOfView: (entity: Container) => boolean;
@@ -0,0 +1,10 @@
1
+ /** @description 判断元素是否超出屏幕 */
2
+ export const libPixiIsOutOfView = (entity) => {
3
+ const bounds = entity.getBounds();
4
+ const viewWidth = window.innerWidth;
5
+ const viewHeight = window.innerHeight;
6
+ return (bounds.x + bounds.width < 0 ||
7
+ bounds.x > viewWidth ||
8
+ bounds.y + bounds.height < 0 ||
9
+ bounds.y > viewHeight);
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.12.67",
3
+ "version": "1.12.69",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {