lyb-pixi-js 1.12.61 → 1.12.63
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.
|
@@ -7,14 +7,10 @@ export class LibPixiMaskBg extends Graphics {
|
|
|
7
7
|
}
|
|
8
8
|
/** @description 更新蒙版 */
|
|
9
9
|
updateSize() {
|
|
10
|
-
const
|
|
11
|
-
const bottomRight = LibPixiMaskBg.stage.toLocal({
|
|
12
|
-
x: window.innerWidth,
|
|
13
|
-
y: window.innerHeight,
|
|
14
|
-
});
|
|
10
|
+
const bounds = LibPixiMaskBg.stage.getLocalBounds();
|
|
15
11
|
this.clear();
|
|
16
12
|
this.beginFill(0x000000, 1);
|
|
17
|
-
this.drawRect(
|
|
13
|
+
this.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
|
18
14
|
this.endFill();
|
|
19
15
|
}
|
|
20
16
|
}
|
package/README.md
CHANGED
|
@@ -200,6 +200,8 @@ app.stage.addChild(box);
|
|
|
200
200
|
|
|
201
201
|
\- [LibPixiPivot-容器锚点设置](#LibPixiPivot-容器锚点设置)
|
|
202
202
|
|
|
203
|
+
\- [LibPixiPivot-容器锚点设置](#libPixiLocalBoundary-本地边界坐标)
|
|
204
|
+
|
|
203
205
|
## Base-基础
|
|
204
206
|
|
|
205
207
|
### LibPixiText-文本
|
|
@@ -1275,4 +1277,8 @@ LibPixiEmitContainerEvent(this, "EVENT_NAME", {});
|
|
|
1275
1277
|
|
|
1276
1278
|
### LibPixiPivot-容器锚点设置
|
|
1277
1279
|
|
|
1278
|
-
> 给容器设置精准的 `Pivot`,但当容器大小改变时,需要重新调用
|
|
1280
|
+
> 给容器设置精准的 `Pivot`,但当容器大小改变时,需要重新调用
|
|
1281
|
+
|
|
1282
|
+
### LibPixiLocalBoundary-本地边界坐标
|
|
1283
|
+
|
|
1284
|
+
> 需要配合 `libJsResizeWatcher` 或 `libJsHorizontal`,因为它俩通过当前项目或游戏的适配模式获取的时机宽高
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Container } from "pixi.js";
|
|
2
|
+
/** @description 获取本地边界坐标
|
|
3
|
+
* 需要配合libJsResizeWatcher或libJsHorizontal,因为它俩通过当前项目或游戏的适配模式获取的时机宽高
|
|
4
|
+
*/
|
|
5
|
+
export declare const libPixiLocalBoundary: (w: number, h: number, stage: Container) => {
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
isLandscape: boolean;
|
|
8
|
+
leftTop: import("pixi.js").Point;
|
|
9
|
+
rightTop: import("pixi.js").Point;
|
|
10
|
+
w: number;
|
|
11
|
+
h: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { libJsIsMobile } from "lyb-js/Browser/LibJsIsMobile.js";
|
|
2
|
+
import { libJsIsPad } from "lyb-js/Browser/LibJsIsPad.js";
|
|
3
|
+
/** @description 获取本地边界坐标
|
|
4
|
+
* 需要配合libJsResizeWatcher或libJsHorizontal,因为它俩通过当前项目或游戏的适配模式获取的时机宽高
|
|
5
|
+
*/
|
|
6
|
+
export const libPixiLocalBoundary = (w, h, stage) => {
|
|
7
|
+
const isMobile = libJsIsMobile() || libJsIsPad();
|
|
8
|
+
const isLandscape = w > h;
|
|
9
|
+
const rightTarget = isMobile
|
|
10
|
+
? isLandscape
|
|
11
|
+
? { x: w, y: 0 }
|
|
12
|
+
: { x: 0, y: h }
|
|
13
|
+
: { x: w, y: 0 };
|
|
14
|
+
const leftTop = stage.toLocal({ x: 0, y: 0 });
|
|
15
|
+
const rightTop = stage.toLocal(rightTarget);
|
|
16
|
+
return {
|
|
17
|
+
isMobile,
|
|
18
|
+
isLandscape,
|
|
19
|
+
leftTop,
|
|
20
|
+
rightTop,
|
|
21
|
+
w,
|
|
22
|
+
h,
|
|
23
|
+
};
|
|
24
|
+
};
|