lyb-pixi-js 1.12.19 → 1.12.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/Components/Custom/LibPixiArrangeLinearV2.d.ts +2 -0
- package/Components/Custom/LibPixiArrangeLinearV2.js +17 -5
- package/Components/Custom/LibPixiTextGroup.d.ts +20 -0
- package/Components/Custom/LibPixiTextGroup.js +50 -0
- package/Components/Custom/LibPixiTextGroupWrap.d.ts +20 -0
- package/Components/Custom/LibPixiTextGroupWrap.js +50 -0
- package/README.md +4 -0
- package/libPixiJs.d.ts +3 -0
- package/libPixiJs.js +3 -0
- package/lyb-pixi.js +160 -111
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export class LibPixiArrangeLinearV2 extends Container {
|
|
|
15
15
|
}
|
|
16
16
|
/** @description 布局 */
|
|
17
17
|
layout() {
|
|
18
|
-
const { colNum = this._elementList.length, gap = 10, direction = "x" } = this._params;
|
|
18
|
+
const { colNum = this._elementList.length, gap = 10, direction = "x", anchorX = 0, anchorY = 0, } = this._params;
|
|
19
19
|
let lastRowMax = 0; // 当前行(或列)的最大高度(或宽度),用于多行/多列换行时计算偏移
|
|
20
20
|
let rowOffset = 0; // 累计偏移量,控制换行后的整体偏移位置
|
|
21
21
|
this._elementList.forEach((item, index) => {
|
|
@@ -24,14 +24,19 @@ export class LibPixiArrangeLinearV2 extends Container {
|
|
|
24
24
|
const col = index % colNum; // 当前列号
|
|
25
25
|
if (direction === "x") {
|
|
26
26
|
//间隔
|
|
27
|
-
const gapValue = Array.isArray(gap) ? (
|
|
27
|
+
const gapValue = Array.isArray(gap) ? (_a = gap[index - 1]) !== null && _a !== void 0 ? _a : 0 : gap;
|
|
28
28
|
//在每行第一列重置列偏移量
|
|
29
29
|
if (col === 0 && row > 0) {
|
|
30
30
|
rowOffset += lastRowMax + gapValue;
|
|
31
31
|
lastRowMax = 0;
|
|
32
32
|
}
|
|
33
33
|
// 横向位置 = 前一个元素的右侧 + 间隔;首列则从 0 开始
|
|
34
|
-
item.x =
|
|
34
|
+
item.x =
|
|
35
|
+
col === 0
|
|
36
|
+
? 0
|
|
37
|
+
: this._elementList[index - 1].x +
|
|
38
|
+
this._elementList[index - 1].width +
|
|
39
|
+
gapValue;
|
|
35
40
|
// 纵向位置 = 当前累计的行偏移
|
|
36
41
|
rowOffset && (item.y = rowOffset);
|
|
37
42
|
// 更新当前行的最大高度
|
|
@@ -39,20 +44,27 @@ export class LibPixiArrangeLinearV2 extends Container {
|
|
|
39
44
|
}
|
|
40
45
|
else {
|
|
41
46
|
//间隔
|
|
42
|
-
const gapValue = Array.isArray(gap) ? (
|
|
47
|
+
const gapValue = Array.isArray(gap) ? (_b = gap[index - 1]) !== null && _b !== void 0 ? _b : 0 : gap;
|
|
43
48
|
//在每列第一行重置行偏移
|
|
44
49
|
if (col === 0 && row > 0) {
|
|
45
50
|
rowOffset += lastRowMax + gapValue;
|
|
46
51
|
lastRowMax = 0;
|
|
47
52
|
}
|
|
48
53
|
// 纵向位置 = 首列则从 0 开始,其余从前一个元素的y坐标 + 高度 + 间隔;
|
|
49
|
-
item.y =
|
|
54
|
+
item.y =
|
|
55
|
+
col === 0
|
|
56
|
+
? 0
|
|
57
|
+
: this._elementList[index - 1].y +
|
|
58
|
+
this._elementList[index - 1].height +
|
|
59
|
+
gapValue;
|
|
50
60
|
// 横向位置 = 当前累计的列偏移
|
|
51
61
|
rowOffset && (item.x = rowOffset);
|
|
52
62
|
// 更新当前列的最大宽度
|
|
53
63
|
lastRowMax = Math.max(lastRowMax, item.width);
|
|
54
64
|
}
|
|
55
65
|
});
|
|
66
|
+
const bounds = this.getLocalBounds();
|
|
67
|
+
this.pivot.set(bounds.x + bounds.width * anchorX, bounds.y + bounds.height * anchorY);
|
|
56
68
|
}
|
|
57
69
|
/** @description 获取列表元素 */
|
|
58
70
|
getList() {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Container, type ITextStyle } from "pixi.js";
|
|
2
|
+
interface TextItem {
|
|
3
|
+
text: string;
|
|
4
|
+
style?: Partial<ITextStyle>;
|
|
5
|
+
}
|
|
6
|
+
interface TextGroupOptions {
|
|
7
|
+
items: TextItem[];
|
|
8
|
+
defaultStyle?: Partial<ITextStyle>;
|
|
9
|
+
wordWrapWidth?: number;
|
|
10
|
+
paddingX?: number;
|
|
11
|
+
paddingY?: number;
|
|
12
|
+
align?: "left" | "center" | "right";
|
|
13
|
+
anchorX?: number;
|
|
14
|
+
anchorY?: number;
|
|
15
|
+
}
|
|
16
|
+
/** @description 文本组换行 */
|
|
17
|
+
export declare class LibPixiTextGroupWrap extends Container {
|
|
18
|
+
constructor({ items, defaultStyle, wordWrapWidth, paddingX, paddingY, align, anchorX, anchorY, }: TextGroupOptions);
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Container, Text } from "pixi.js";
|
|
2
|
+
/** @description 文本组换行 */
|
|
3
|
+
export class LibPixiTextGroupWrap extends Container {
|
|
4
|
+
constructor({ items, defaultStyle = {}, wordWrapWidth, paddingX = 0, paddingY = 0, align = "left", anchorX = 0, anchorY = 0, }) {
|
|
5
|
+
super();
|
|
6
|
+
if (!items.length)
|
|
7
|
+
return;
|
|
8
|
+
const lineGroups = [];
|
|
9
|
+
let currentLine = [];
|
|
10
|
+
let x = 0;
|
|
11
|
+
// 分行
|
|
12
|
+
for (const { text, style = {} } of items) {
|
|
13
|
+
const instance = new Text(text, Object.assign(Object.assign({}, defaultStyle), style));
|
|
14
|
+
const w = instance.width;
|
|
15
|
+
if (wordWrapWidth && x + w > wordWrapWidth && x > 0) {
|
|
16
|
+
lineGroups.push(currentLine);
|
|
17
|
+
currentLine = [];
|
|
18
|
+
x = 0;
|
|
19
|
+
}
|
|
20
|
+
currentLine.push(instance);
|
|
21
|
+
x += w + paddingX;
|
|
22
|
+
}
|
|
23
|
+
if (currentLine.length)
|
|
24
|
+
lineGroups.push(currentLine);
|
|
25
|
+
// 布局每行
|
|
26
|
+
let y = 0;
|
|
27
|
+
for (const line of lineGroups) {
|
|
28
|
+
const totalWidth = line.reduce((sum, i) => sum + i.width + paddingX, -paddingX);
|
|
29
|
+
let offsetX = 0;
|
|
30
|
+
if (align === "center" && wordWrapWidth)
|
|
31
|
+
offsetX = (wordWrapWidth - totalWidth) / 2;
|
|
32
|
+
else if (align === "right" && wordWrapWidth)
|
|
33
|
+
offsetX = wordWrapWidth - totalWidth;
|
|
34
|
+
let currentX = offsetX;
|
|
35
|
+
let maxHeight = 0;
|
|
36
|
+
for (const item of line) {
|
|
37
|
+
item.x = currentX;
|
|
38
|
+
item.y = y;
|
|
39
|
+
this.addChild(item);
|
|
40
|
+
currentX += item.width + paddingX;
|
|
41
|
+
if (item.height > maxHeight)
|
|
42
|
+
maxHeight = item.height;
|
|
43
|
+
}
|
|
44
|
+
y += maxHeight + paddingY;
|
|
45
|
+
}
|
|
46
|
+
// 根据 anchor 调整整体偏移
|
|
47
|
+
const bounds = this.getLocalBounds();
|
|
48
|
+
this.pivot.set(bounds.x + bounds.width * anchorX, bounds.y + bounds.height * anchorY);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Container, type ITextStyle } from "pixi.js";
|
|
2
|
+
interface TextItem {
|
|
3
|
+
text: string;
|
|
4
|
+
style?: Partial<ITextStyle>;
|
|
5
|
+
}
|
|
6
|
+
interface TextGroupOptions {
|
|
7
|
+
items: TextItem[];
|
|
8
|
+
defaultStyle?: Partial<ITextStyle>;
|
|
9
|
+
wordWrapWidth?: number;
|
|
10
|
+
paddingX?: number;
|
|
11
|
+
paddingY?: number;
|
|
12
|
+
align?: "left" | "center" | "right";
|
|
13
|
+
anchorX?: number;
|
|
14
|
+
anchorY?: number;
|
|
15
|
+
}
|
|
16
|
+
/** @description 文本组换行 */
|
|
17
|
+
export declare class LibPixiTextGroupWrap extends Container {
|
|
18
|
+
constructor({ items, defaultStyle, wordWrapWidth, paddingX, paddingY, align, anchorX, anchorY, }: TextGroupOptions);
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Container, Text } from "pixi.js";
|
|
2
|
+
/** @description 文本组换行 */
|
|
3
|
+
export class LibPixiTextGroupWrap extends Container {
|
|
4
|
+
constructor({ items, defaultStyle = {}, wordWrapWidth, paddingX = 0, paddingY = 0, align = "left", anchorX = 0, anchorY = 0, }) {
|
|
5
|
+
super();
|
|
6
|
+
if (!items.length)
|
|
7
|
+
return;
|
|
8
|
+
const lineGroups = [];
|
|
9
|
+
let currentLine = [];
|
|
10
|
+
let x = 0;
|
|
11
|
+
// 分行
|
|
12
|
+
for (const { text, style = {} } of items) {
|
|
13
|
+
const instance = new Text(text, Object.assign(Object.assign({}, defaultStyle), style));
|
|
14
|
+
const w = instance.width;
|
|
15
|
+
if (wordWrapWidth && x + w > wordWrapWidth && x > 0) {
|
|
16
|
+
lineGroups.push(currentLine);
|
|
17
|
+
currentLine = [];
|
|
18
|
+
x = 0;
|
|
19
|
+
}
|
|
20
|
+
currentLine.push(instance);
|
|
21
|
+
x += w + paddingX;
|
|
22
|
+
}
|
|
23
|
+
if (currentLine.length)
|
|
24
|
+
lineGroups.push(currentLine);
|
|
25
|
+
// 布局每行
|
|
26
|
+
let y = 0;
|
|
27
|
+
for (const line of lineGroups) {
|
|
28
|
+
const totalWidth = line.reduce((sum, i) => sum + i.width + paddingX, -paddingX);
|
|
29
|
+
let offsetX = 0;
|
|
30
|
+
if (align === "center" && wordWrapWidth)
|
|
31
|
+
offsetX = (wordWrapWidth - totalWidth) / 2;
|
|
32
|
+
else if (align === "right" && wordWrapWidth)
|
|
33
|
+
offsetX = wordWrapWidth - totalWidth;
|
|
34
|
+
let currentX = offsetX;
|
|
35
|
+
let maxHeight = 0;
|
|
36
|
+
for (const item of line) {
|
|
37
|
+
item.x = currentX;
|
|
38
|
+
item.y = y;
|
|
39
|
+
this.addChild(item);
|
|
40
|
+
currentX += item.width + paddingX;
|
|
41
|
+
if (item.height > maxHeight)
|
|
42
|
+
maxHeight = item.height;
|
|
43
|
+
}
|
|
44
|
+
y += maxHeight + paddingY;
|
|
45
|
+
}
|
|
46
|
+
// 根据 anchor 调整整体偏移
|
|
47
|
+
const bounds = this.getLocalBounds();
|
|
48
|
+
this.pivot.set(bounds.x + bounds.width * anchorX, bounds.y + bounds.height * anchorY);
|
|
49
|
+
}
|
|
50
|
+
}
|
package/README.md
CHANGED
package/libPixiJs.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ import { LibPixiInput } from "./Components/Custom/LibPixiInput";
|
|
|
36
36
|
import { LibPixiGridLayoutV2 } from "./Utils/LibPixiGridLayoutV2";
|
|
37
37
|
import { LibPixiTicker } from "./Utils/LibPixiTicker";
|
|
38
38
|
import { LibPixiArrangeLinearV2 } from "./Components/Custom/LibPixiArrangeLinearV2";
|
|
39
|
+
import { LibPixiTextGroupWrap } from "./Components/Custom/LibPixiTextGroupWrap";
|
|
39
40
|
/** @description 组件 */
|
|
40
41
|
export declare const Components: {
|
|
41
42
|
Base: {
|
|
@@ -153,6 +154,8 @@ export declare const Components: {
|
|
|
153
154
|
LibPixiInput: typeof LibPixiInput;
|
|
154
155
|
/** @description 线性排列 */
|
|
155
156
|
LibPixiArrangeLinearV2: typeof LibPixiArrangeLinearV2;
|
|
157
|
+
/** @description 文本组换行 */
|
|
158
|
+
LibPixiTextGroupWrap: typeof LibPixiTextGroupWrap;
|
|
156
159
|
};
|
|
157
160
|
};
|
|
158
161
|
/** @description 方法 */
|
package/libPixiJs.js
CHANGED
|
@@ -55,6 +55,7 @@ import { LibPixiInput } from "./Components/Custom/LibPixiInput";
|
|
|
55
55
|
import { LibPixiGridLayoutV2 } from "./Utils/LibPixiGridLayoutV2";
|
|
56
56
|
import { LibPixiTicker } from "./Utils/LibPixiTicker";
|
|
57
57
|
import { LibPixiArrangeLinearV2 } from "./Components/Custom/LibPixiArrangeLinearV2";
|
|
58
|
+
import { LibPixiTextGroupWrap } from "./Components/Custom/LibPixiTextGroupWrap";
|
|
58
59
|
/** @description 组件 */
|
|
59
60
|
export const Components = {
|
|
60
61
|
Base: {
|
|
@@ -172,6 +173,8 @@ export const Components = {
|
|
|
172
173
|
LibPixiInput,
|
|
173
174
|
/** @description 线性排列 */
|
|
174
175
|
LibPixiArrangeLinearV2,
|
|
176
|
+
/** @description 文本组换行 */
|
|
177
|
+
LibPixiTextGroupWrap,
|
|
175
178
|
},
|
|
176
179
|
};
|
|
177
180
|
/** @description 方法 */
|
package/lyb-pixi.js
CHANGED
|
@@ -1315,7 +1315,7 @@
|
|
|
1315
1315
|
var ys = arrObjKeys(obj, inspect2);
|
|
1316
1316
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
1317
1317
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
1318
|
-
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
1318
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
|
|
1319
1319
|
var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
1320
1320
|
var tag2 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
|
|
1321
1321
|
if (ys.length === 0) {
|
|
@@ -1337,25 +1337,25 @@
|
|
|
1337
1337
|
return $replace$1.call(String(s2), /"/g, """);
|
|
1338
1338
|
}
|
|
1339
1339
|
function isArray$3(obj) {
|
|
1340
|
-
return toStr(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1340
|
+
return toStr$1(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1341
1341
|
}
|
|
1342
1342
|
function isDate(obj) {
|
|
1343
|
-
return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1343
|
+
return toStr$1(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1344
1344
|
}
|
|
1345
1345
|
function isRegExp$1(obj) {
|
|
1346
|
-
return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1346
|
+
return toStr$1(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1347
1347
|
}
|
|
1348
1348
|
function isError(obj) {
|
|
1349
|
-
return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1349
|
+
return toStr$1(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1350
1350
|
}
|
|
1351
1351
|
function isString(obj) {
|
|
1352
|
-
return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1352
|
+
return toStr$1(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1353
1353
|
}
|
|
1354
1354
|
function isNumber(obj) {
|
|
1355
|
-
return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1355
|
+
return toStr$1(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1356
1356
|
}
|
|
1357
1357
|
function isBoolean(obj) {
|
|
1358
|
-
return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1358
|
+
return toStr$1(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1359
1359
|
}
|
|
1360
1360
|
function isSymbol(obj) {
|
|
1361
1361
|
if (hasShammedSymbols) {
|
|
@@ -1391,7 +1391,7 @@
|
|
|
1391
1391
|
function has$3(obj, key) {
|
|
1392
1392
|
return hasOwn$1.call(obj, key);
|
|
1393
1393
|
}
|
|
1394
|
-
function toStr(obj) {
|
|
1394
|
+
function toStr$1(obj) {
|
|
1395
1395
|
return objectToString.call(obj);
|
|
1396
1396
|
}
|
|
1397
1397
|
function nameOf(f2) {
|
|
@@ -1700,7 +1700,7 @@
|
|
|
1700
1700
|
var uri = URIError;
|
|
1701
1701
|
var abs$2 = Math.abs;
|
|
1702
1702
|
var floor$2 = Math.floor;
|
|
1703
|
-
var max$
|
|
1703
|
+
var max$3 = Math.max;
|
|
1704
1704
|
var min$2 = Math.min;
|
|
1705
1705
|
var pow$2 = Math.pow;
|
|
1706
1706
|
var round$3 = Math.round;
|
|
@@ -1833,102 +1833,78 @@
|
|
|
1833
1833
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
1834
1834
|
return Object_getPrototypeOf;
|
|
1835
1835
|
}
|
|
1836
|
-
var
|
|
1837
|
-
var
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
var
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
var
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
var joiny = function(arr, joiner) {
|
|
1864
|
-
var str = "";
|
|
1865
|
-
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
1866
|
-
str += arr[i2];
|
|
1867
|
-
if (i2 + 1 < arr.length) {
|
|
1868
|
-
str += joiner;
|
|
1869
|
-
}
|
|
1836
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
1837
|
+
var toStr = Object.prototype.toString;
|
|
1838
|
+
var max$2 = Math.max;
|
|
1839
|
+
var funcType = "[object Function]";
|
|
1840
|
+
var concatty = function concatty2(a2, b2) {
|
|
1841
|
+
var arr = [];
|
|
1842
|
+
for (var i2 = 0; i2 < a2.length; i2 += 1) {
|
|
1843
|
+
arr[i2] = a2[i2];
|
|
1844
|
+
}
|
|
1845
|
+
for (var j2 = 0; j2 < b2.length; j2 += 1) {
|
|
1846
|
+
arr[j2 + a2.length] = b2[j2];
|
|
1847
|
+
}
|
|
1848
|
+
return arr;
|
|
1849
|
+
};
|
|
1850
|
+
var slicy = function slicy2(arrLike, offset) {
|
|
1851
|
+
var arr = [];
|
|
1852
|
+
for (var i2 = offset || 0, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
|
|
1853
|
+
arr[j2] = arrLike[i2];
|
|
1854
|
+
}
|
|
1855
|
+
return arr;
|
|
1856
|
+
};
|
|
1857
|
+
var joiny = function(arr, joiner) {
|
|
1858
|
+
var str = "";
|
|
1859
|
+
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
1860
|
+
str += arr[i2];
|
|
1861
|
+
if (i2 + 1 < arr.length) {
|
|
1862
|
+
str += joiner;
|
|
1870
1863
|
}
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
);
|
|
1886
|
-
if (Object(result) === result) {
|
|
1887
|
-
return result;
|
|
1888
|
-
}
|
|
1889
|
-
return this;
|
|
1890
|
-
}
|
|
1891
|
-
return target.apply(
|
|
1892
|
-
that,
|
|
1864
|
+
}
|
|
1865
|
+
return str;
|
|
1866
|
+
};
|
|
1867
|
+
var implementation$1 = function bind2(that) {
|
|
1868
|
+
var target = this;
|
|
1869
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
1870
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
1871
|
+
}
|
|
1872
|
+
var args = slicy(arguments, 1);
|
|
1873
|
+
var bound;
|
|
1874
|
+
var binder = function() {
|
|
1875
|
+
if (this instanceof bound) {
|
|
1876
|
+
var result = target.apply(
|
|
1877
|
+
this,
|
|
1893
1878
|
concatty(args, arguments)
|
|
1894
1879
|
);
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
boundArgs[i2] = "$" + i2;
|
|
1900
|
-
}
|
|
1901
|
-
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
1902
|
-
if (target.prototype) {
|
|
1903
|
-
var Empty = function Empty2() {
|
|
1904
|
-
};
|
|
1905
|
-
Empty.prototype = target.prototype;
|
|
1906
|
-
bound.prototype = new Empty();
|
|
1907
|
-
Empty.prototype = null;
|
|
1880
|
+
if (Object(result) === result) {
|
|
1881
|
+
return result;
|
|
1882
|
+
}
|
|
1883
|
+
return this;
|
|
1908
1884
|
}
|
|
1909
|
-
return
|
|
1885
|
+
return target.apply(
|
|
1886
|
+
that,
|
|
1887
|
+
concatty(args, arguments)
|
|
1888
|
+
);
|
|
1910
1889
|
};
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
functionCall = Function.prototype.call;
|
|
1930
|
-
return functionCall;
|
|
1931
|
-
}
|
|
1890
|
+
var boundLength = max$2(0, target.length - args.length);
|
|
1891
|
+
var boundArgs = [];
|
|
1892
|
+
for (var i2 = 0; i2 < boundLength; i2++) {
|
|
1893
|
+
boundArgs[i2] = "$" + i2;
|
|
1894
|
+
}
|
|
1895
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
1896
|
+
if (target.prototype) {
|
|
1897
|
+
var Empty = function Empty2() {
|
|
1898
|
+
};
|
|
1899
|
+
Empty.prototype = target.prototype;
|
|
1900
|
+
bound.prototype = new Empty();
|
|
1901
|
+
Empty.prototype = null;
|
|
1902
|
+
}
|
|
1903
|
+
return bound;
|
|
1904
|
+
};
|
|
1905
|
+
var implementation = implementation$1;
|
|
1906
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
1907
|
+
var functionCall = Function.prototype.call;
|
|
1932
1908
|
var functionApply;
|
|
1933
1909
|
var hasRequiredFunctionApply;
|
|
1934
1910
|
function requireFunctionApply() {
|
|
@@ -1939,14 +1915,14 @@
|
|
|
1939
1915
|
return functionApply;
|
|
1940
1916
|
}
|
|
1941
1917
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
1942
|
-
var bind$2 =
|
|
1918
|
+
var bind$2 = functionBind;
|
|
1943
1919
|
var $apply$1 = requireFunctionApply();
|
|
1944
|
-
var $call$2 =
|
|
1920
|
+
var $call$2 = functionCall;
|
|
1945
1921
|
var $reflectApply = reflectApply;
|
|
1946
1922
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
1947
|
-
var bind$1 =
|
|
1923
|
+
var bind$1 = functionBind;
|
|
1948
1924
|
var $TypeError$4 = type;
|
|
1949
|
-
var $call$1 =
|
|
1925
|
+
var $call$1 = functionCall;
|
|
1950
1926
|
var $actualApply = actualApply;
|
|
1951
1927
|
var callBindApplyHelpers = function callBindBasic2(args) {
|
|
1952
1928
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -2015,7 +1991,7 @@
|
|
|
2015
1991
|
hasRequiredHasown = 1;
|
|
2016
1992
|
var call = Function.prototype.call;
|
|
2017
1993
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
2018
|
-
var bind2 =
|
|
1994
|
+
var bind2 = functionBind;
|
|
2019
1995
|
hasown = bind2.call(call, $hasOwn);
|
|
2020
1996
|
return hasown;
|
|
2021
1997
|
}
|
|
@@ -2030,7 +2006,7 @@
|
|
|
2030
2006
|
var $URIError = uri;
|
|
2031
2007
|
var abs$1 = abs$2;
|
|
2032
2008
|
var floor$1 = floor$2;
|
|
2033
|
-
var max$1 = max$
|
|
2009
|
+
var max$1 = max$3;
|
|
2034
2010
|
var min$1 = min$2;
|
|
2035
2011
|
var pow$1 = pow$2;
|
|
2036
2012
|
var round$2 = round$3;
|
|
@@ -2064,7 +2040,7 @@
|
|
|
2064
2040
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
2065
2041
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
2066
2042
|
var $apply = requireFunctionApply();
|
|
2067
|
-
var $call =
|
|
2043
|
+
var $call = functionCall;
|
|
2068
2044
|
var needsEval = {};
|
|
2069
2045
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
2070
2046
|
var INTRINSICS = {
|
|
@@ -2234,7 +2210,7 @@
|
|
|
2234
2210
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
2235
2211
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
2236
2212
|
};
|
|
2237
|
-
var bind =
|
|
2213
|
+
var bind = functionBind;
|
|
2238
2214
|
var hasOwn = requireHasown();
|
|
2239
2215
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
2240
2216
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
@@ -58449,7 +58425,13 @@ void main(void){
|
|
|
58449
58425
|
}
|
|
58450
58426
|
/** @description 布局 */
|
|
58451
58427
|
layout() {
|
|
58452
|
-
const {
|
|
58428
|
+
const {
|
|
58429
|
+
colNum = this._elementList.length,
|
|
58430
|
+
gap = 10,
|
|
58431
|
+
direction = "x",
|
|
58432
|
+
anchorX = 0,
|
|
58433
|
+
anchorY = 0
|
|
58434
|
+
} = this._params;
|
|
58453
58435
|
let lastRowMax = 0;
|
|
58454
58436
|
let rowOffset = 0;
|
|
58455
58437
|
this._elementList.forEach((item, index) => {
|
|
@@ -58475,6 +58457,11 @@ void main(void){
|
|
|
58475
58457
|
lastRowMax = Math.max(lastRowMax, item.width);
|
|
58476
58458
|
}
|
|
58477
58459
|
});
|
|
58460
|
+
const bounds = this.getLocalBounds();
|
|
58461
|
+
this.pivot.set(
|
|
58462
|
+
bounds.x + bounds.width * anchorX,
|
|
58463
|
+
bounds.y + bounds.height * anchorY
|
|
58464
|
+
);
|
|
58478
58465
|
}
|
|
58479
58466
|
/** @description 获取列表元素 */
|
|
58480
58467
|
getList() {
|
|
@@ -58488,6 +58475,66 @@ void main(void){
|
|
|
58488
58475
|
this._elementList = [];
|
|
58489
58476
|
}
|
|
58490
58477
|
}
|
|
58478
|
+
class LibPixiTextGroupWrap extends Container {
|
|
58479
|
+
constructor({
|
|
58480
|
+
items,
|
|
58481
|
+
defaultStyle = {},
|
|
58482
|
+
wordWrapWidth,
|
|
58483
|
+
paddingX = 0,
|
|
58484
|
+
paddingY = 0,
|
|
58485
|
+
align = "left",
|
|
58486
|
+
anchorX = 0,
|
|
58487
|
+
anchorY = 0
|
|
58488
|
+
}) {
|
|
58489
|
+
super();
|
|
58490
|
+
if (!items.length)
|
|
58491
|
+
return;
|
|
58492
|
+
const lineGroups = [];
|
|
58493
|
+
let currentLine = [];
|
|
58494
|
+
let x2 = 0;
|
|
58495
|
+
for (const { text, style = {} } of items) {
|
|
58496
|
+
const instance2 = new Text(text, { ...defaultStyle, ...style });
|
|
58497
|
+
const w2 = instance2.width;
|
|
58498
|
+
if (wordWrapWidth && x2 + w2 > wordWrapWidth && x2 > 0) {
|
|
58499
|
+
lineGroups.push(currentLine);
|
|
58500
|
+
currentLine = [];
|
|
58501
|
+
x2 = 0;
|
|
58502
|
+
}
|
|
58503
|
+
currentLine.push(instance2);
|
|
58504
|
+
x2 += w2 + paddingX;
|
|
58505
|
+
}
|
|
58506
|
+
if (currentLine.length)
|
|
58507
|
+
lineGroups.push(currentLine);
|
|
58508
|
+
let y2 = 0;
|
|
58509
|
+
for (const line of lineGroups) {
|
|
58510
|
+
const totalWidth = line.reduce(
|
|
58511
|
+
(sum2, i2) => sum2 + i2.width + paddingX,
|
|
58512
|
+
-paddingX
|
|
58513
|
+
);
|
|
58514
|
+
let offsetX = 0;
|
|
58515
|
+
if (align === "center" && wordWrapWidth)
|
|
58516
|
+
offsetX = (wordWrapWidth - totalWidth) / 2;
|
|
58517
|
+
else if (align === "right" && wordWrapWidth)
|
|
58518
|
+
offsetX = wordWrapWidth - totalWidth;
|
|
58519
|
+
let currentX = offsetX;
|
|
58520
|
+
let maxHeight = 0;
|
|
58521
|
+
for (const item of line) {
|
|
58522
|
+
item.x = currentX;
|
|
58523
|
+
item.y = y2;
|
|
58524
|
+
this.addChild(item);
|
|
58525
|
+
currentX += item.width + paddingX;
|
|
58526
|
+
if (item.height > maxHeight)
|
|
58527
|
+
maxHeight = item.height;
|
|
58528
|
+
}
|
|
58529
|
+
y2 += maxHeight + paddingY;
|
|
58530
|
+
}
|
|
58531
|
+
const bounds = this.getLocalBounds();
|
|
58532
|
+
this.pivot.set(
|
|
58533
|
+
bounds.x + bounds.width * anchorX,
|
|
58534
|
+
bounds.y + bounds.height * anchorY
|
|
58535
|
+
);
|
|
58536
|
+
}
|
|
58537
|
+
}
|
|
58491
58538
|
const Components = {
|
|
58492
58539
|
Base: {
|
|
58493
58540
|
/** (已废弃)
|
|
@@ -58603,7 +58650,9 @@ void main(void){
|
|
|
58603
58650
|
/** @description 输入框 */
|
|
58604
58651
|
LibPixiInput,
|
|
58605
58652
|
/** @description 线性排列 */
|
|
58606
|
-
LibPixiArrangeLinearV2
|
|
58653
|
+
LibPixiArrangeLinearV2,
|
|
58654
|
+
/** @description 文本组换行 */
|
|
58655
|
+
LibPixiTextGroupWrap
|
|
58607
58656
|
}
|
|
58608
58657
|
};
|
|
58609
58658
|
const Utils = {
|