lyb-pixi-js 1.7.6 → 1.8.0

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.
@@ -0,0 +1,35 @@
1
+ import { HTMLText, type TextStyleAlign, type TextStyleFontWeight } from "pixi.js";
2
+ export interface LibPixiHtmlTextParams {
3
+ /** 文本内容 */
4
+ text: string | number;
5
+ /** 字体大小 */
6
+ fontSize?: number;
7
+ /** 字体颜色 */
8
+ fontColor?: any;
9
+ /** 是否描边 */
10
+ stroke?: boolean;
11
+ /** 描边颜色 */
12
+ strokeColor?: string | number;
13
+ /** 描边宽度 */
14
+ strokeThickness?: number;
15
+ /** 字体样式 */
16
+ fontFamily?: string;
17
+ /** 字体粗细 */
18
+ fontWeight?: TextStyleFontWeight;
19
+ /** 是否换行 */
20
+ wordWrap?: boolean;
21
+ /** 换行宽度 */
22
+ wordWrapWidth?: number;
23
+ /** 行高 */
24
+ lineHeight?: number;
25
+ /** 对齐方式 */
26
+ align?: TextStyleAlign;
27
+ /** 阴影-颜色 角度 模糊度 阴影距离 */
28
+ shadow?: [string, number, number, number];
29
+ }
30
+ /** @description 自定义富文本类
31
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-富文本
32
+ */
33
+ export declare class LibPixiHtmlText extends HTMLText {
34
+ constructor(options: LibPixiHtmlTextParams);
35
+ }
@@ -0,0 +1,30 @@
1
+ import { HTMLText, } from "pixi.js";
2
+ /** @description 自定义富文本类
3
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-富文本
4
+ */
5
+ export class LibPixiHtmlText extends HTMLText {
6
+ constructor(options) {
7
+ const { text, fontSize = 36, fontColor = 0xffffff, stroke, strokeColor, strokeThickness, fontFamily = "Arial", fontWeight = "normal", wordWrap = false, wordWrapWidth = 100, lineHeight = 1.25, align = "left", shadow, } = options;
8
+ super(text.toString(), {
9
+ fontSize,
10
+ wordWrap,
11
+ wordWrapWidth,
12
+ fontWeight,
13
+ lineHeight: lineHeight * fontSize,
14
+ breakWords: wordWrap,
15
+ fill: fontColor,
16
+ align,
17
+ whiteSpace: "normal",
18
+ fontFamily: fontFamily,
19
+ stroke: stroke ? strokeColor : "transparent",
20
+ strokeThickness: stroke ? strokeThickness : 0,
21
+ });
22
+ if (shadow) {
23
+ this.style.dropShadow = true;
24
+ this.style.dropShadowColor = shadow[0];
25
+ this.style.dropShadowAngle = shadow[1] * (Math.PI / 180);
26
+ this.style.dropShadowBlur = shadow[2];
27
+ this.style.dropShadowDistance = shadow[3];
28
+ }
29
+ }
30
+ }
package/README.md CHANGED
@@ -84,12 +84,20 @@ app.stage.addChild(box);
84
84
 
85
85
  \- [LibPixiText-文本](#LibPixiText-文本)
86
86
 
87
+ \- [LibPixiHtmlText-富文本](#LibPixiHtmlText-富文本)
88
+
87
89
  \- [LibPixiBitText-位图](#LibPixiBitText-位图)
88
90
 
89
91
  \- [LibPixiContainer-容器](#LibPixiContainer-容器)
90
92
 
91
93
  \- [LibPixiRectBgColor-矩形](#LibPixiRectBgColor-矩形)
92
94
 
95
+ \- [LibPixiRectangle-矩形](#LibPixiRectangle-矩形)
96
+
97
+ \- [LibPixiCircular-圆形](#LibPixiCircular-圆形)
98
+
99
+ \- [LibPixiPolygon-多边形](#LibPixiPolygon-多边形)
100
+
93
101
  \- [LibPixiSpine-动画](#LibPixiSpine-动画)
94
102
 
95
103
  \- [LibPixiParticleMove-粒子容器](#LibPixiParticleMove-粒子容器)
@@ -104,9 +112,9 @@ app.stage.addChild(box);
104
112
 
105
113
  \- [LibPixiProgress-进度条](#LibPixiProgress-进度条)
106
114
 
107
- \- [LibPixiScrollContainerX-X轴滚动容器](#LibPixiScrollContainerX-X轴滚动容器)
115
+ \- [LibPixiScrollContainerX-X 轴滚动容器](#LibPixiScrollContainerX-X轴滚动容器)
108
116
 
109
- \- [LibPixiScrollContainerY-Y轴滚动容器](#LibPixiScrollContainerY-Y轴滚动容器)
117
+ \- [LibPixiScrollContainerY-Y 轴滚动容器](#LibPixiScrollContainerY-Y轴滚动容器)
110
118
 
111
119
  \- [LibPixiScrollNum-数字滑动](#LibPixiScrollNum-数字滑动)
112
120
 
@@ -190,15 +198,53 @@ interface LibPixiTextParams {
190
198
  }
191
199
  ```
192
200
 
201
+ ### LibPixiHtmlText-富文本
202
+
203
+ > 自定义富文本类
204
+
205
+ ```ts
206
+ const text = new LibPixiHtmlText(LibPixiTextParams);
207
+ this.addChild(text);
208
+
209
+ interface LibPixiHtmlTextParams {
210
+ /** 文本内容 */
211
+ text: string | number;
212
+ /** 字体大小 */
213
+ fontSize?: number;
214
+ /** 字体颜色 */
215
+ fontColor?: any;
216
+ /** 是否描边 */
217
+ stroke?: boolean;
218
+ /** 描边颜色 */
219
+ strokeColor?: string | number;
220
+ /** 描边宽度 */
221
+ strokeThickness?: number;
222
+ /** 字体样式 */
223
+ fontFamily?: string;
224
+ /** 字体粗细 */
225
+ fontWeight?: TextStyleFontWeight;
226
+ /** 是否换行 */
227
+ wordWrap?: boolean;
228
+ /** 换行宽度 */
229
+ wordWrapWidth?: number;
230
+ /** 行高 */
231
+ lineHeight?: number;
232
+ /** 对齐方式 */
233
+ align?: TextStyleAlign;
234
+ /** 阴影-颜色 角度 模糊度 阴影距离 */
235
+ shadow?: [string, number, number, number];
236
+ }
237
+ ```
238
+
193
239
  ### LibPixiBitText-位图
194
240
 
195
241
  > 自定义位图文本
196
242
 
197
243
  ```ts
198
244
  /**
199
- * @param fontName 字体名称
200
- * @param defaultFontSize 默认字体大小
201
- */
245
+ * @param fontName 字体名称
246
+ * @param defaultFontSize 默认字体大小
247
+ */
202
248
 
203
249
  //所有文字使用同一个字体大小
204
250
  const font = new LibPixiBitText("FontName", 16);
@@ -219,11 +265,11 @@ this.addChild(fontText2);
219
265
 
220
266
  ```ts
221
267
  /**
222
- * @param width 容器宽度
223
- * @param height 容器高度
224
- * @param bgColor 背景色
225
- * @param overHidden 是否溢出裁剪
226
- */
268
+ * @param width 容器宽度
269
+ * @param height 容器高度
270
+ * @param bgColor 背景色
271
+ * @param overHidden 是否溢出裁剪
272
+ */
227
273
  const box = new LibPixiJs.Base.LibPixiContainer(100, 100, "#fff", true);
228
274
  this.addChild(box);
229
275
  ```
@@ -256,6 +302,35 @@ interface LibPixiRectBgColorParams {
256
302
  }
257
303
  ```
258
304
 
305
+ ### LibPixiRectangle-矩形
306
+
307
+ > `LibPixiRectBgColor`精简版,可用于一些场景的局部点击,传颜色是为了方便定位,最终可能需要将颜色隐藏掉
308
+
309
+ ```ts
310
+ const libPixiRectangle = new LibPixiRectangle(100, 100, "#fff");
311
+ ```
312
+
313
+ ### LibPixiPolygon-多边形
314
+
315
+ > 多边形类,可用于一些场景的局部点击,传颜色是为了方便定位,最终可能需要将颜色隐藏掉
316
+
317
+ ```ts
318
+ const polygonVertices = new LibPixiPolygon([
319
+ 0, 0, 604, 0, 596, 32, 616, 30, 611, 62, 644, 57, 643, 87, 697, 82, 702, 102, 724, 86, 744, 83, 753, 91, 756, 83,
320
+ 772, 85, 793, 100, 797, 114, 794, 316, 798, 336, 799, 476, 796, 491, 801, 507, 797, 635, 742, 656, 723, 683, 659,
321
+ 687, 638, 678, 646, 712, 617, 707, 611, 717, 618, 741, 596, 734, 595, 746, 601, 762, 14, 763, 18, 739, -4, 741, 4,
322
+ 712, -5, 705, -28, 711, -22, 686, -34, 679, -47, 686, -195, 686, -189, 667, -192, 647, -195, 506, -192, 499, -194,
323
+ 476, -192, 331, -187, 323, -193, 307, -194, 110, -188, 103, -189, 93, -172, 81, -112, 82, -98, 95, -93, 80, -56,
324
+ 82, -40, 89, -36, 80, -41, 57, -30, 57, -16, 62, -8, 58, -16, 29, 1, 35, 8, 25, 0, 0,
325
+ ], "#000");
326
+ ```
327
+
328
+ ### LibPixiCircular-圆形
329
+
330
+ ```ts
331
+ const libPixiCircular = new LibPixiCircular(100, "#fff");
332
+ ```
333
+
259
334
  ### LibPixiSpine-动画
260
335
 
261
336
  > 自定义 Spine 动画,内置挂点
@@ -320,60 +395,60 @@ interface LibPixiSpineParams {
320
395
  > 利用贝塞尔曲线实现粒子移动
321
396
 
322
397
  ```ts
323
- const libParticleMove = new LibPixiJs.Components.Base.LibPixiParticleMove({
324
- start: { x: 0, y: window.innerHeight },
325
- control: [
326
- { x: 1000, y: 750 },
327
- { x: 500, y: 250 },
328
- ],
329
- end: { x: 0, y: 0 },
330
- container: PIXI.Assets.get("fly.png"),
331
- duration: 1,
332
- showControl: true,
333
- ease: "power1.in",
334
- particleConfig: {
335
- frequency: 0.001,
336
- blendMode: "add",
337
- lifetime: {
338
- min: 0.01,
339
- max: 1,
340
- },
341
- alpha: {
342
- start: 1,
343
- end: 0,
344
- },
345
- color: {
346
- start: "#fff96c",
347
- end: "#ff837f",
348
- },
349
- scale: {
350
- start: 2,
351
- end: 3,
352
- },
353
- rotation: {
354
- min: 0,
355
- max: 360,
356
- },
357
- rotate: {
358
- min: 0,
359
- max: 360,
360
- },
361
- speed: {
362
- start: 0,
363
- end: 0,
364
- },
398
+ const libParticleMove = new LibPixiJs.Components.Base.LibPixiParticleMove({
399
+ start: { x: 0, y: window.innerHeight },
400
+ control: [
401
+ { x: 1000, y: 750 },
402
+ { x: 500, y: 250 },
403
+ ],
404
+ end: { x: 0, y: 0 },
405
+ container: PIXI.Assets.get("fly.png"),
406
+ duration: 1,
407
+ showControl: true,
408
+ ease: "power1.in",
409
+ particleConfig: {
410
+ frequency: 0.001,
411
+ blendMode: "add",
412
+ lifetime: {
413
+ min: 0.01,
414
+ max: 1,
415
+ },
416
+ alpha: {
417
+ start: 1,
418
+ end: 0,
419
+ },
420
+ color: {
421
+ start: "#fff96c",
422
+ end: "#ff837f",
423
+ },
424
+ scale: {
425
+ start: 2,
426
+ end: 3,
427
+ },
428
+ rotation: {
429
+ min: 0,
430
+ max: 360,
431
+ },
432
+ rotate: {
433
+ min: 0,
434
+ max: 360,
365
435
  },
436
+ speed: {
437
+ start: 0,
438
+ end: 0,
439
+ },
440
+ },
366
441
 
367
- onDestroy: (destroy) => {
368
- gsap.to(libParticleMove, {
369
- alpha: 0,
370
- onComplete: () => {
371
- destroy()
372
- }
373
- })
374
- }
375
- });
376
- app.stage.addChild(libParticleMove);
442
+ onDestroy: (destroy) => {
443
+ gsap.to(libParticleMove, {
444
+ alpha: 0,
445
+ onComplete: () => {
446
+ destroy();
447
+ },
448
+ });
449
+ },
450
+ });
451
+ app.stage.addChild(libParticleMove);
377
452
 
378
453
  export interface LibPixiParticleMoveParams {
379
454
  /** 粒子JSON资源 */
@@ -579,7 +654,7 @@ progress.setProgress(0.5); //50% 完成
579
654
  app.stage.addChild(progress);
580
655
  ```
581
656
 
582
- ### LibPixiScrollContainerX-X轴滚动容器
657
+ ### LibPixiScrollContainerX-X 轴滚动容器
583
658
 
584
659
  > 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
585
660
 
@@ -609,7 +684,7 @@ scrollContainer.setDimensions(800, 600);
609
684
  scrollContainer.addContent(new Sprite(Texture.from("new-content.png")));
610
685
  ```
611
686
 
612
- ### LibPixiScrollContainerY-Y轴滚动容器
687
+ ### LibPixiScrollContainerY-Y 轴滚动容器
613
688
 
614
689
  > 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
615
690
 
@@ -1048,4 +1123,4 @@ $bus.on("play", () => {
1048
1123
 
1049
1124
  ```ts
1050
1125
  new LibPixiPolygonDrawTool(app);
1051
- ```
1126
+ ```
package/libPixiJs.d.ts CHANGED
@@ -19,6 +19,7 @@ import { LibPixiAudio } from "./Utils/LibPixiAudio";
19
19
  import { LibPixiSlideInput } from "./Utils/LibPixiSlideInput";
20
20
  import { LibPixiGlobalUpdater } from "./Utils/LibPixiGlobalUpdater";
21
21
  import { LibPixiPolygonDrawTool } from "./Utils/LibPixiPolygonDrawTool";
22
+ import { LibPixiHtmlText } from './Components/Base/LibPixiHtmlText';
22
23
  /** @description 组件 */
23
24
  export declare const Components: {
24
25
  Base: {
@@ -46,6 +47,10 @@ export declare const Components: {
46
47
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
47
48
  */
48
49
  LibPixiText: typeof LibPixiText;
50
+ /** @description 自定义富文本类
51
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
52
+ */
53
+ LibPixiHtmlText: typeof LibPixiHtmlText;
49
54
  };
50
55
  Custom: {
51
56
  /** @description 悬浮切换材质
package/libPixiJs.js CHANGED
@@ -29,6 +29,7 @@ import { libPixiTickerTimeout } from "./Utils/LibPixiTickerTimeout";
29
29
  import { LibPixiSlideInput } from "./Utils/LibPixiSlideInput";
30
30
  import { LibPixiGlobalUpdater } from "./Utils/LibPixiGlobalUpdater";
31
31
  import { LibPixiPolygonDrawTool } from "./Utils/LibPixiPolygonDrawTool";
32
+ import { LibPixiHtmlText } from './Components/Base/LibPixiHtmlText';
32
33
  /** @description 组件 */
33
34
  export const Components = {
34
35
  Base: {
@@ -56,6 +57,10 @@ export const Components = {
56
57
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
57
58
  */
58
59
  LibPixiText,
60
+ /** @description 自定义富文本类
61
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
62
+ */
63
+ LibPixiHtmlText,
59
64
  },
60
65
  Custom: {
61
66
  /** @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$1(obj), 8, -1) : protoTag ? "Object" : "";
1318
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
1319
1319
  var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
1320
1320
  var tag = 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$1(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1340
+ return toStr(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1341
1341
  }
1342
1342
  function isDate(obj) {
1343
- return toStr$1(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1343
+ return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1344
1344
  }
1345
1345
  function isRegExp$1(obj) {
1346
- return toStr$1(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1346
+ return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1347
1347
  }
1348
1348
  function isError(obj) {
1349
- return toStr$1(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1349
+ return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1350
1350
  }
1351
1351
  function isString(obj) {
1352
- return toStr$1(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1352
+ return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1353
1353
  }
1354
1354
  function isNumber(obj) {
1355
- return toStr$1(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1355
+ return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1356
1356
  }
1357
1357
  function isBoolean(obj) {
1358
- return toStr$1(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1358
+ return toStr(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$1(obj) {
1394
+ function toStr(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$1 = Math.abs;
1702
1702
  var floor$1 = Math.floor;
1703
- var max$2 = Math.max;
1703
+ var max$1 = Math.max;
1704
1704
  var min$1 = Math.min;
1705
1705
  var pow$1 = Math.pow;
1706
1706
  var round$2 = Math.round;
@@ -1833,78 +1833,102 @@
1833
1833
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
1834
1834
  return Object_getPrototypeOf;
1835
1835
  }
1836
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
1837
- var toStr = Object.prototype.toString;
1838
- var max$1 = 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;
1836
+ var implementation;
1837
+ var hasRequiredImplementation;
1838
+ function requireImplementation() {
1839
+ if (hasRequiredImplementation)
1840
+ return implementation;
1841
+ hasRequiredImplementation = 1;
1842
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
1843
+ var toStr2 = Object.prototype.toString;
1844
+ var max2 = Math.max;
1845
+ var funcType = "[object Function]";
1846
+ var concatty = function concatty2(a2, b2) {
1847
+ var arr = [];
1848
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
1849
+ arr[i2] = a2[i2];
1863
1850
  }
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,
1878
- concatty(args, arguments)
1879
- );
1880
- if (Object(result) === result) {
1881
- return result;
1851
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
1852
+ arr[j2 + a2.length] = b2[j2];
1853
+ }
1854
+ return arr;
1855
+ };
1856
+ var slicy = function slicy2(arrLike, offset) {
1857
+ var arr = [];
1858
+ for (var i2 = offset || 0, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
1859
+ arr[j2] = arrLike[i2];
1860
+ }
1861
+ return arr;
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;
1882
1869
  }
1883
- return this;
1884
1870
  }
1885
- return target.apply(
1886
- that,
1887
- concatty(args, arguments)
1888
- );
1871
+ return str;
1889
1872
  };
1890
- var boundLength = max$1(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() {
1873
+ implementation = function bind2(that) {
1874
+ var target = this;
1875
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
1876
+ throw new TypeError(ERROR_MESSAGE + target);
1877
+ }
1878
+ var args = slicy(arguments, 1);
1879
+ var bound;
1880
+ var binder = function() {
1881
+ if (this instanceof bound) {
1882
+ var result = target.apply(
1883
+ this,
1884
+ concatty(args, arguments)
1885
+ );
1886
+ if (Object(result) === result) {
1887
+ return result;
1888
+ }
1889
+ return this;
1890
+ }
1891
+ return target.apply(
1892
+ that,
1893
+ concatty(args, arguments)
1894
+ );
1898
1895
  };
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;
1896
+ var boundLength = max2(0, target.length - args.length);
1897
+ var boundArgs = [];
1898
+ for (var i2 = 0; i2 < boundLength; i2++) {
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;
1908
+ }
1909
+ return bound;
1910
+ };
1911
+ return implementation;
1912
+ }
1913
+ var functionBind;
1914
+ var hasRequiredFunctionBind;
1915
+ function requireFunctionBind() {
1916
+ if (hasRequiredFunctionBind)
1917
+ return functionBind;
1918
+ hasRequiredFunctionBind = 1;
1919
+ var implementation2 = requireImplementation();
1920
+ functionBind = Function.prototype.bind || implementation2;
1921
+ return functionBind;
1922
+ }
1923
+ var functionCall;
1924
+ var hasRequiredFunctionCall;
1925
+ function requireFunctionCall() {
1926
+ if (hasRequiredFunctionCall)
1927
+ return functionCall;
1928
+ hasRequiredFunctionCall = 1;
1929
+ functionCall = Function.prototype.call;
1930
+ return functionCall;
1931
+ }
1908
1932
  var functionApply;
1909
1933
  var hasRequiredFunctionApply;
1910
1934
  function requireFunctionApply() {
@@ -1915,14 +1939,14 @@
1915
1939
  return functionApply;
1916
1940
  }
1917
1941
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
1918
- var bind$2 = functionBind;
1942
+ var bind$2 = requireFunctionBind();
1919
1943
  var $apply$1 = requireFunctionApply();
1920
- var $call$2 = functionCall;
1944
+ var $call$2 = requireFunctionCall();
1921
1945
  var $reflectApply = reflectApply;
1922
1946
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
1923
- var bind$1 = functionBind;
1947
+ var bind$1 = requireFunctionBind();
1924
1948
  var $TypeError$4 = type;
1925
- var $call$1 = functionCall;
1949
+ var $call$1 = requireFunctionCall();
1926
1950
  var $actualApply = actualApply;
1927
1951
  var callBindApplyHelpers = function callBindBasic2(args) {
1928
1952
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -1991,7 +2015,7 @@
1991
2015
  hasRequiredHasown = 1;
1992
2016
  var call = Function.prototype.call;
1993
2017
  var $hasOwn = Object.prototype.hasOwnProperty;
1994
- var bind2 = functionBind;
2018
+ var bind2 = requireFunctionBind();
1995
2019
  hasown = bind2.call(call, $hasOwn);
1996
2020
  return hasown;
1997
2021
  }
@@ -2006,7 +2030,7 @@
2006
2030
  var $URIError = uri;
2007
2031
  var abs = abs$1;
2008
2032
  var floor = floor$1;
2009
- var max = max$2;
2033
+ var max = max$1;
2010
2034
  var min = min$1;
2011
2035
  var pow = pow$1;
2012
2036
  var round$1 = round$2;
@@ -2040,7 +2064,7 @@
2040
2064
  var $ObjectGPO = requireObject_getPrototypeOf();
2041
2065
  var $ReflectGPO = requireReflect_getPrototypeOf();
2042
2066
  var $apply = requireFunctionApply();
2043
- var $call = functionCall;
2067
+ var $call = requireFunctionCall();
2044
2068
  var needsEval = {};
2045
2069
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
2046
2070
  var INTRINSICS = {
@@ -2210,7 +2234,7 @@
2210
2234
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
2211
2235
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
2212
2236
  };
2213
- var bind = functionBind;
2237
+ var bind = requireFunctionBind();
2214
2238
  var hasOwn = requireHasown();
2215
2239
  var $concat = bind.call($call, Array.prototype.concat);
2216
2240
  var $spliceApply = bind.call($apply, Array.prototype.splice);
@@ -25679,6 +25703,7 @@ void main(void)\r
25679
25703
  _HTMLText.defaultMaxWidth = 2024, /** Default maxHeight, set at construction */
25680
25704
  _HTMLText.defaultMaxHeight = 2024, /** Default autoResolution for all HTMLText objects */
25681
25705
  _HTMLText.defaultAutoResolution = true;
25706
+ let HTMLText = _HTMLText;
25682
25707
  class LibPixiBitText {
25683
25708
  /**
25684
25709
  * @param fontName 字体名称
@@ -54812,6 +54837,46 @@ void main(void){
54812
54837
  return pointElement;
54813
54838
  }
54814
54839
  }
54840
+ class LibPixiHtmlText extends HTMLText {
54841
+ constructor(options) {
54842
+ const {
54843
+ text,
54844
+ fontSize = 36,
54845
+ fontColor = 16777215,
54846
+ stroke,
54847
+ strokeColor,
54848
+ strokeThickness,
54849
+ fontFamily = "Arial",
54850
+ fontWeight = "normal",
54851
+ wordWrap = false,
54852
+ wordWrapWidth = 100,
54853
+ lineHeight = 1.25,
54854
+ align = "left",
54855
+ shadow
54856
+ } = options;
54857
+ super(text.toString(), {
54858
+ fontSize,
54859
+ wordWrap,
54860
+ wordWrapWidth,
54861
+ fontWeight,
54862
+ lineHeight: lineHeight * fontSize,
54863
+ breakWords: wordWrap,
54864
+ fill: fontColor,
54865
+ align,
54866
+ whiteSpace: "normal",
54867
+ fontFamily,
54868
+ stroke: stroke ? strokeColor : "transparent",
54869
+ strokeThickness: stroke ? strokeThickness : 0
54870
+ });
54871
+ if (shadow) {
54872
+ this.style.dropShadow = true;
54873
+ this.style.dropShadowColor = shadow[0];
54874
+ this.style.dropShadowAngle = shadow[1] * (Math.PI / 180);
54875
+ this.style.dropShadowBlur = shadow[2];
54876
+ this.style.dropShadowDistance = shadow[3];
54877
+ }
54878
+ }
54879
+ }
54815
54880
  const Components = {
54816
54881
  Base: {
54817
54882
  /** @description 自定义位图文本
@@ -54837,7 +54902,11 @@ void main(void){
54837
54902
  /** @description 自定义文本类
54838
54903
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
54839
54904
  */
54840
- LibPixiText
54905
+ LibPixiText,
54906
+ /** @description 自定义富文本类
54907
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
54908
+ */
54909
+ LibPixiHtmlText
54841
54910
  },
54842
54911
  Custom: {
54843
54912
  /** @description 悬浮切换材质
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.7.6",
3
+ "version": "1.8.0",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {