lyb-pixi-js 1.10.7 → 1.10.8
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/Components/Custom/LibPixiPuzzleBg.d.ts +7 -0
- package/Components/Custom/LibPixiPuzzleBg.js +45 -0
- package/Components/Custom/LibPixiScrollContainerX.d.ts +1 -1
- package/Components/Custom/LibPixiScrollContainerX.js +1 -1
- package/Components/Custom/LibPixiScrollContainerY.d.ts +1 -1
- package/Components/Custom/LibPixiScrollContainerY.js +1 -1
- package/libPixiJs.d.ts +5 -0
- package/libPixiJs.js +5 -0
- package/lyb-pixi.js +2834 -455
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { libJsDecimal } from "lyb-js/Math/LibJsDecimal.js";
|
|
2
|
+
import { Assets, Container, Sprite } from "pixi.js";
|
|
3
|
+
/** @description 设计图背景拼接
|
|
4
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
|
|
5
|
+
*/
|
|
6
|
+
export class LibPixiPuzzleBg extends Container {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.eventMode = "none";
|
|
10
|
+
// 背景
|
|
11
|
+
const bg = new Sprite(Assets.get("preload/bg"));
|
|
12
|
+
this.addChild(bg);
|
|
13
|
+
bg.visible = false;
|
|
14
|
+
//读取配置
|
|
15
|
+
const config = JSON.parse(localStorage.getItem("puzzle_bg_config") || "{}");
|
|
16
|
+
const { alpha, x, y } = config;
|
|
17
|
+
bg.alpha = alpha || 0.25;
|
|
18
|
+
bg.position.set(x || 0, y || 0);
|
|
19
|
+
//监听鼠标空格事件
|
|
20
|
+
document.addEventListener("keydown", (e) => {
|
|
21
|
+
if (e.code === "Space") {
|
|
22
|
+
bg.visible = !bg.visible;
|
|
23
|
+
}
|
|
24
|
+
else if (e.code === "ArrowUp") {
|
|
25
|
+
bg.y -= 2;
|
|
26
|
+
}
|
|
27
|
+
else if (e.code === "ArrowDown") {
|
|
28
|
+
bg.y += 2;
|
|
29
|
+
}
|
|
30
|
+
else if (e.code === "ArrowLeft") {
|
|
31
|
+
bg.x -= 2;
|
|
32
|
+
}
|
|
33
|
+
else if (e.code === "ArrowRight") {
|
|
34
|
+
bg.x += 2;
|
|
35
|
+
}
|
|
36
|
+
if (e.code === "NumpadAdd" && bg.alpha < 1) {
|
|
37
|
+
bg.alpha = libJsDecimal(bg.alpha, 0.1, "+");
|
|
38
|
+
}
|
|
39
|
+
else if (e.code === "NumpadSubtract" && bg.alpha > 0) {
|
|
40
|
+
bg.alpha = libJsDecimal(bg.alpha, 0.1, "-");
|
|
41
|
+
}
|
|
42
|
+
localStorage.setItem("puzzle_bg_config", JSON.stringify({ alpha: bg.alpha, x: bg.x, y: bg.y }));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -13,7 +13,7 @@ export interface LibPixiScrollContainerXParams {
|
|
|
13
13
|
rightMargin?: number;
|
|
14
14
|
}
|
|
15
15
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
16
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X
|
|
16
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X轴滚动容器
|
|
17
17
|
*/
|
|
18
18
|
export declare class LibPixiScrollContainerX extends LibPixiContainer {
|
|
19
19
|
/** 开始位置 */
|
|
@@ -2,7 +2,7 @@ import { Container, Graphics, Sprite, } from "pixi.js";
|
|
|
2
2
|
import { gsap } from "gsap";
|
|
3
3
|
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
4
4
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
5
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X
|
|
5
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X轴滚动容器
|
|
6
6
|
*/
|
|
7
7
|
export class LibPixiScrollContainerX extends LibPixiContainer {
|
|
8
8
|
constructor(params) {
|
|
@@ -23,7 +23,7 @@ export interface LibPixiScrollContainerYParams {
|
|
|
23
23
|
onScroll?: (y: number) => void;
|
|
24
24
|
}
|
|
25
25
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
26
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y
|
|
26
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y轴滚动容器
|
|
27
27
|
*/
|
|
28
28
|
export declare class LibPixiScrollContainerY extends LibPixiContainer {
|
|
29
29
|
/** 开始位置 */
|
|
@@ -4,7 +4,7 @@ import { libPixiEvent } from "../../Utils/LibPixiEvent";
|
|
|
4
4
|
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
5
5
|
import { LibPixiRectangle } from "../Base/LibPixiRectangle";
|
|
6
6
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
7
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y
|
|
7
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y轴滚动容器
|
|
8
8
|
*/
|
|
9
9
|
export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
10
10
|
constructor(params) {
|
package/libPixiJs.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { LibPixiPolygon } from "./Components/Base/LibPixiPolygon";
|
|
|
25
25
|
import { LibPixiCircular } from "./Components/Base/LibPixiCircular";
|
|
26
26
|
import { LibPixiSlide } from "./Components/Custom/LibPixiSlide";
|
|
27
27
|
import { LibPixiLabelValue } from "./Components/Custom/LibPixiLabelValue";
|
|
28
|
+
import { LibPixiPuzzleBg } from "./Components/Custom/LibPixiPuzzleBg";
|
|
28
29
|
/** @description 组件 */
|
|
29
30
|
export declare const Components: {
|
|
30
31
|
Base: {
|
|
@@ -122,6 +123,10 @@ export declare const Components: {
|
|
|
122
123
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
|
|
123
124
|
*/
|
|
124
125
|
LibPixiLabelValue: typeof LibPixiLabelValue;
|
|
126
|
+
/** @description 设计图背景拼接
|
|
127
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
|
|
128
|
+
*/
|
|
129
|
+
LibPixiPuzzleBg: typeof LibPixiPuzzleBg;
|
|
125
130
|
};
|
|
126
131
|
};
|
|
127
132
|
/** @description 方法 */
|
package/libPixiJs.js
CHANGED
|
@@ -40,6 +40,7 @@ import { LibPixiArrangeLinear } from "./Utils/LibPixiArrangeLinear";
|
|
|
40
40
|
import { LibPixiSlide } from "./Components/Custom/LibPixiSlide";
|
|
41
41
|
import { LibPixiEmitContainerEvent } from "./Utils/LibPixiEmitContainerEvent";
|
|
42
42
|
import { LibPixiLabelValue } from "./Components/Custom/LibPixiLabelValue";
|
|
43
|
+
import { LibPixiPuzzleBg } from "./Components/Custom/LibPixiPuzzleBg";
|
|
43
44
|
/** @description 组件 */
|
|
44
45
|
export const Components = {
|
|
45
46
|
Base: {
|
|
@@ -137,6 +138,10 @@ export const Components = {
|
|
|
137
138
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
|
|
138
139
|
*/
|
|
139
140
|
LibPixiLabelValue,
|
|
141
|
+
/** @description 设计图背景拼接
|
|
142
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
|
|
143
|
+
*/
|
|
144
|
+
LibPixiPuzzleBg,
|
|
140
145
|
},
|
|
141
146
|
};
|
|
142
147
|
/** @description 方法 */
|