lyb-pixi-js 1.12.20 → 1.12.22
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/LibPixiInput.d.ts +2 -2
- package/Components/Custom/LibPixiInput.js +2 -1
- package/Components/Custom/LibPixiProgress.d.ts +4 -0
- package/Components/Custom/LibPixiProgress.js +14 -3
- package/Components/Custom/LibPixiPuzzleBg.d.ts +2 -2
- package/Components/Custom/LibPixiPuzzleBg.js +3 -3
- package/lyb-pixi.js +34 -19
- package/package.json +1 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Container } from "pixi.js";
|
|
2
2
|
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
3
3
|
interface Params {
|
|
4
|
-
/** 舞台 */
|
|
5
|
-
stage: Container;
|
|
6
4
|
/** 宽度 */
|
|
7
5
|
width: number;
|
|
8
6
|
/** 高度 */
|
|
@@ -42,6 +40,8 @@ interface Params {
|
|
|
42
40
|
}
|
|
43
41
|
/** @description 动态缩放移动输入框 */
|
|
44
42
|
export declare class LibPixiInput extends LibPixiContainer {
|
|
43
|
+
/** 舞台 */
|
|
44
|
+
static stage: Container;
|
|
45
45
|
/** 参数 */
|
|
46
46
|
private _params;
|
|
47
47
|
/** 只读输入框 */
|
|
@@ -158,7 +158,8 @@ export class LibPixiInput extends LibPixiContainer {
|
|
|
158
158
|
this._input.style.width = `${width}px`;
|
|
159
159
|
this._input.style.height = `${height}px`;
|
|
160
160
|
this._input.style.fontSize = `${height * fontSizeRatio}px`;
|
|
161
|
-
|
|
161
|
+
console.log(LibPixiInput.stage);
|
|
162
|
+
if (LibPixiInput.stage.rotation === 0) {
|
|
162
163
|
this._input.style.left = `${x}px`;
|
|
163
164
|
this._input.style.top = `${y}px`;
|
|
164
165
|
this._input.style.width = `${width}px`;
|
|
@@ -12,6 +12,8 @@ export interface LibPixiProgressParams {
|
|
|
12
12
|
bgTexture: Texture;
|
|
13
13
|
/** 进度条纹理 */
|
|
14
14
|
barTexture: Texture;
|
|
15
|
+
/** 方向 */
|
|
16
|
+
direction?: "h" | "v";
|
|
15
17
|
}
|
|
16
18
|
/** @description 通过裁剪的方式显示进度条
|
|
17
19
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiProgress-进度条
|
|
@@ -21,6 +23,8 @@ export declare class LibPixiProgress extends Container {
|
|
|
21
23
|
private _progressBar;
|
|
22
24
|
/** 蒙版 */
|
|
23
25
|
private _maskGraphics;
|
|
26
|
+
/** 方向 */
|
|
27
|
+
private _direction;
|
|
24
28
|
constructor(params: LibPixiProgressParams);
|
|
25
29
|
/** @description 更新进度
|
|
26
30
|
* @param progress 进度值,范围从0到1
|
|
@@ -5,7 +5,8 @@ import { Container, Graphics, Sprite } from "pixi.js";
|
|
|
5
5
|
export class LibPixiProgress extends Container {
|
|
6
6
|
constructor(params) {
|
|
7
7
|
super();
|
|
8
|
-
const { bgWidth, bgHeight, barWidth, barHeight, bgTexture, barTexture } = params;
|
|
8
|
+
const { bgWidth, bgHeight, barWidth, barHeight, bgTexture, barTexture, direction } = params;
|
|
9
|
+
this._direction = direction || "h";
|
|
9
10
|
// 背景图
|
|
10
11
|
const background = new Sprite(bgTexture);
|
|
11
12
|
this.addChild(background);
|
|
@@ -17,7 +18,12 @@ export class LibPixiProgress extends Container {
|
|
|
17
18
|
// 创建蒙版
|
|
18
19
|
const mask = new Graphics();
|
|
19
20
|
mask.beginFill(0xffffff);
|
|
20
|
-
|
|
21
|
+
if (direction === "h") {
|
|
22
|
+
mask.drawRect(0, 0, 0, this._progressBar.height);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
mask.drawRect(0, 0, this._progressBar.width, 0);
|
|
26
|
+
}
|
|
21
27
|
mask.endFill();
|
|
22
28
|
this._progressBar.addChild(mask);
|
|
23
29
|
this._progressBar.mask = mask;
|
|
@@ -30,7 +36,12 @@ export class LibPixiProgress extends Container {
|
|
|
30
36
|
const clampedProgress = Math.max(0, Math.min(1, progress));
|
|
31
37
|
this._maskGraphics.clear();
|
|
32
38
|
this._maskGraphics.beginFill(0xffffff);
|
|
33
|
-
|
|
39
|
+
if (this._direction === "h") {
|
|
40
|
+
this._maskGraphics.drawRect(0, 0, this._progressBar.width * clampedProgress, this._progressBar.height);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this._maskGraphics.drawRect(0, this._progressBar.height * (1 - clampedProgress), this._progressBar.width, this._progressBar.height * clampedProgress);
|
|
44
|
+
}
|
|
34
45
|
this._maskGraphics.endFill();
|
|
35
46
|
}
|
|
36
47
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Container } from "pixi.js";
|
|
1
|
+
import { Container, Texture } from "pixi.js";
|
|
2
2
|
/** @description 设计图背景拼接
|
|
3
3
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
|
|
4
4
|
*/
|
|
5
5
|
export declare class LibPixiPuzzleBg extends Container {
|
|
6
|
-
constructor();
|
|
6
|
+
constructor(texture: Texture);
|
|
7
7
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { libJsDecimal } from "lyb-js/Math/LibJsDecimal.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Container, Sprite } from "pixi.js";
|
|
3
3
|
/** @description 设计图背景拼接
|
|
4
4
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
|
|
5
5
|
*/
|
|
6
6
|
export class LibPixiPuzzleBg extends Container {
|
|
7
|
-
constructor() {
|
|
7
|
+
constructor(texture) {
|
|
8
8
|
super();
|
|
9
9
|
this.eventMode = "none";
|
|
10
10
|
// 背景
|
|
11
|
-
const bg = new Sprite(
|
|
11
|
+
const bg = new Sprite(texture);
|
|
12
12
|
this.addChild(bg);
|
|
13
13
|
bg.visible = false;
|
|
14
14
|
//读取配置
|
package/lyb-pixi.js
CHANGED
|
@@ -1904,7 +1904,15 @@
|
|
|
1904
1904
|
};
|
|
1905
1905
|
var implementation = implementation$1;
|
|
1906
1906
|
var functionBind = Function.prototype.bind || implementation;
|
|
1907
|
-
var functionCall
|
|
1907
|
+
var functionCall;
|
|
1908
|
+
var hasRequiredFunctionCall;
|
|
1909
|
+
function requireFunctionCall() {
|
|
1910
|
+
if (hasRequiredFunctionCall)
|
|
1911
|
+
return functionCall;
|
|
1912
|
+
hasRequiredFunctionCall = 1;
|
|
1913
|
+
functionCall = Function.prototype.call;
|
|
1914
|
+
return functionCall;
|
|
1915
|
+
}
|
|
1908
1916
|
var functionApply;
|
|
1909
1917
|
var hasRequiredFunctionApply;
|
|
1910
1918
|
function requireFunctionApply() {
|
|
@@ -1917,12 +1925,12 @@
|
|
|
1917
1925
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
1918
1926
|
var bind$2 = functionBind;
|
|
1919
1927
|
var $apply$1 = requireFunctionApply();
|
|
1920
|
-
var $call$2 =
|
|
1928
|
+
var $call$2 = requireFunctionCall();
|
|
1921
1929
|
var $reflectApply = reflectApply;
|
|
1922
1930
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
1923
1931
|
var bind$1 = functionBind;
|
|
1924
1932
|
var $TypeError$4 = type;
|
|
1925
|
-
var $call$1 =
|
|
1933
|
+
var $call$1 = requireFunctionCall();
|
|
1926
1934
|
var $actualApply = actualApply;
|
|
1927
1935
|
var callBindApplyHelpers = function callBindBasic2(args) {
|
|
1928
1936
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -2040,7 +2048,7 @@
|
|
|
2040
2048
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
2041
2049
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
2042
2050
|
var $apply = requireFunctionApply();
|
|
2043
|
-
var $call =
|
|
2051
|
+
var $call = requireFunctionCall();
|
|
2044
2052
|
var needsEval = {};
|
|
2045
2053
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
2046
2054
|
var INTRINSICS = {
|
|
@@ -49159,7 +49167,8 @@ void main(void)\r
|
|
|
49159
49167
|
class LibPixiProgress extends Container {
|
|
49160
49168
|
constructor(params) {
|
|
49161
49169
|
super();
|
|
49162
|
-
const { bgWidth, bgHeight, barWidth, barHeight, bgTexture, barTexture } = params;
|
|
49170
|
+
const { bgWidth, bgHeight, barWidth, barHeight, bgTexture, barTexture, direction } = params;
|
|
49171
|
+
this._direction = direction || "h";
|
|
49163
49172
|
const background = new Sprite(bgTexture);
|
|
49164
49173
|
this.addChild(background);
|
|
49165
49174
|
this._progressBar = new Sprite(barTexture);
|
|
@@ -49168,7 +49177,11 @@ void main(void)\r
|
|
|
49168
49177
|
this._progressBar.y = (bgHeight - barHeight) / 2;
|
|
49169
49178
|
const mask = new Graphics();
|
|
49170
49179
|
mask.beginFill(16777215);
|
|
49171
|
-
|
|
49180
|
+
if (direction === "h") {
|
|
49181
|
+
mask.drawRect(0, 0, 0, this._progressBar.height);
|
|
49182
|
+
} else {
|
|
49183
|
+
mask.drawRect(0, 0, this._progressBar.width, 0);
|
|
49184
|
+
}
|
|
49172
49185
|
mask.endFill();
|
|
49173
49186
|
this._progressBar.addChild(mask);
|
|
49174
49187
|
this._progressBar.mask = mask;
|
|
@@ -49181,12 +49194,16 @@ void main(void)\r
|
|
|
49181
49194
|
const clampedProgress = Math.max(0, Math.min(1, progress));
|
|
49182
49195
|
this._maskGraphics.clear();
|
|
49183
49196
|
this._maskGraphics.beginFill(16777215);
|
|
49184
|
-
this.
|
|
49185
|
-
0,
|
|
49186
|
-
|
|
49187
|
-
this.
|
|
49188
|
-
|
|
49189
|
-
|
|
49197
|
+
if (this._direction === "h") {
|
|
49198
|
+
this._maskGraphics.drawRect(0, 0, this._progressBar.width * clampedProgress, this._progressBar.height);
|
|
49199
|
+
} else {
|
|
49200
|
+
this._maskGraphics.drawRect(
|
|
49201
|
+
0,
|
|
49202
|
+
this._progressBar.height * (1 - clampedProgress),
|
|
49203
|
+
this._progressBar.width,
|
|
49204
|
+
this._progressBar.height * clampedProgress
|
|
49205
|
+
);
|
|
49206
|
+
}
|
|
49190
49207
|
this._maskGraphics.endFill();
|
|
49191
49208
|
}
|
|
49192
49209
|
}
|
|
@@ -57763,10 +57780,10 @@ void main(void){
|
|
|
57763
57780
|
return Number(result.toFixed(point, Decimal.ROUND_DOWN));
|
|
57764
57781
|
};
|
|
57765
57782
|
class LibPixiPuzzleBg extends Container {
|
|
57766
|
-
constructor() {
|
|
57783
|
+
constructor(texture) {
|
|
57767
57784
|
super();
|
|
57768
57785
|
this.eventMode = "none";
|
|
57769
|
-
const bg = new Sprite(
|
|
57786
|
+
const bg = new Sprite(texture);
|
|
57770
57787
|
this.addChild(bg);
|
|
57771
57788
|
bg.visible = false;
|
|
57772
57789
|
const config2 = JSON.parse(localStorage.getItem("puzzle_bg_config") || "{}");
|
|
@@ -57791,10 +57808,7 @@ void main(void){
|
|
|
57791
57808
|
} else if (e2.code === "NumpadSubtract" && bg.alpha > 0) {
|
|
57792
57809
|
bg.alpha = libJsDecimal(bg.alpha, 0.1, "-");
|
|
57793
57810
|
}
|
|
57794
|
-
localStorage.setItem(
|
|
57795
|
-
"puzzle_bg_config",
|
|
57796
|
-
JSON.stringify({ alpha: bg.alpha, x: bg.x, y: bg.y })
|
|
57797
|
-
);
|
|
57811
|
+
localStorage.setItem("puzzle_bg_config", JSON.stringify({ alpha: bg.alpha, x: bg.x, y: bg.y }));
|
|
57798
57812
|
});
|
|
57799
57813
|
}
|
|
57800
57814
|
}
|
|
@@ -58308,7 +58322,8 @@ void main(void){
|
|
|
58308
58322
|
this._input.style.width = `${width}px`;
|
|
58309
58323
|
this._input.style.height = `${height}px`;
|
|
58310
58324
|
this._input.style.fontSize = `${height * fontSizeRatio}px`;
|
|
58311
|
-
|
|
58325
|
+
console.log(LibPixiInput.stage);
|
|
58326
|
+
if (LibPixiInput.stage.rotation === 0) {
|
|
58312
58327
|
this._input.style.left = `${x2}px`;
|
|
58313
58328
|
this._input.style.top = `${y2}px`;
|
|
58314
58329
|
this._input.style.width = `${width}px`;
|