lyb-pixi-js 1.12.29 → 1.12.31

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,6 +7,10 @@ interface Params {
7
7
  height: number;
8
8
  /** 字体与高度比 */
9
9
  fontSizeRatio: number;
10
+ /** 使用字体 */
11
+ fontFamily?: string;
12
+ /** 是否加粗 */
13
+ bold?: boolean;
10
14
  /** 是否需要placeholder */
11
15
  placeholder?: string;
12
16
  /** placeholder颜色 */
@@ -14,7 +18,7 @@ interface Params {
14
18
  /** 背景色,用于调试输入框的位置 */
15
19
  bgColor?: string;
16
20
  /** 输入类型 */
17
- type?: "number" | "text";
21
+ type?: "number" | "text" | "password";
18
22
  /** 字体颜色 */
19
23
  color?: string;
20
24
  /** 初始值 */
@@ -61,7 +61,7 @@ export class LibPixiInput extends LibPixiContainer {
61
61
  }
62
62
  /** @description 创建输入框 */
63
63
  _createInput() {
64
- const { color = "#fff", maxLength = 999999, align = "left", type = "text", onInput = () => { }, } = this._params;
64
+ const { color = "#fff", maxLength = 999999, align = "left", type = "text", onInput = () => { }, fontFamily = "", bold = false, } = this._params;
65
65
  this._input = document.createElement("input");
66
66
  this._input.type = type;
67
67
  this._input.maxLength = maxLength;
@@ -73,6 +73,8 @@ export class LibPixiInput extends LibPixiContainer {
73
73
  background-color: transparent;
74
74
  color: ${color};
75
75
  text-align: ${align};
76
+ font-family: ${fontFamily};
77
+ font-bold: ${bold ? "bold" : "normal"}
76
78
  `;
77
79
  document.querySelector("#game").appendChild(this._input);
78
80
  this._input.addEventListener("input", function () {
@@ -93,12 +95,14 @@ export class LibPixiInput extends LibPixiContainer {
93
95
  }
94
96
  /** @description 创建只读输入框 */
95
97
  _createReadOnlyInput() {
96
- const { color = "#fff", value = "", width, height, fontSizeRatio = 0.5, align = "left", placeholder = "", placeholderColor, } = this._params;
98
+ const { color = "#fff", value = "", width, height, fontSizeRatio = 0.5, align = "left", placeholder = "", placeholderColor, fontFamily = "", bold = false, } = this._params;
97
99
  //创建描述
98
100
  this._placeholder = new LibPixiText({
99
101
  text: placeholder,
100
102
  fontColor: placeholderColor,
101
103
  fontSize: height * fontSizeRatio,
104
+ fontFamily,
105
+ fontWeight: bold ? "bold" : "normal",
102
106
  });
103
107
  this.addChild(this._placeholder);
104
108
  this._placeholder.visible = !value;
@@ -109,6 +113,8 @@ export class LibPixiInput extends LibPixiContainer {
109
113
  text: value,
110
114
  fontColor: color,
111
115
  fontSize: height * fontSizeRatio,
116
+ fontFamily,
117
+ fontWeight: bold ? "bold" : "normal",
112
118
  });
113
119
  this.addChild(this._readonlyInput);
114
120
  this._readonlyInput.visible = !!value;
package/lyb-pixi.js CHANGED
@@ -58270,7 +58270,9 @@ void main(void){
58270
58270
  align = "left",
58271
58271
  type: type2 = "text",
58272
58272
  onInput = () => {
58273
- }
58273
+ },
58274
+ fontFamily = "",
58275
+ bold = false
58274
58276
  } = this._params;
58275
58277
  this._input = document.createElement("input");
58276
58278
  this._input.type = type2;
@@ -58283,6 +58285,8 @@ void main(void){
58283
58285
  background-color: transparent;
58284
58286
  color: ${color};
58285
58287
  text-align: ${align};
58288
+ font-family: ${fontFamily};
58289
+ font-bold: ${bold ? "bold" : "normal"}
58286
58290
  `;
58287
58291
  document.querySelector("#game").appendChild(this._input);
58288
58292
  this._input.addEventListener("input", function() {
@@ -58311,12 +58315,16 @@ void main(void){
58311
58315
  fontSizeRatio = 0.5,
58312
58316
  align = "left",
58313
58317
  placeholder = "",
58314
- placeholderColor
58318
+ placeholderColor,
58319
+ fontFamily = "",
58320
+ bold = false
58315
58321
  } = this._params;
58316
58322
  this._placeholder = new LibPixiText({
58317
58323
  text: placeholder,
58318
58324
  fontColor: placeholderColor,
58319
- fontSize: height * fontSizeRatio
58325
+ fontSize: height * fontSizeRatio,
58326
+ fontFamily,
58327
+ fontWeight: bold ? "bold" : "normal"
58320
58328
  });
58321
58329
  this.addChild(this._placeholder);
58322
58330
  this._placeholder.visible = !value;
@@ -58328,7 +58336,9 @@ void main(void){
58328
58336
  this._readonlyInput = new LibPixiText({
58329
58337
  text: value,
58330
58338
  fontColor: color,
58331
- fontSize: height * fontSizeRatio
58339
+ fontSize: height * fontSizeRatio,
58340
+ fontFamily,
58341
+ fontWeight: bold ? "bold" : "normal"
58332
58342
  });
58333
58343
  this.addChild(this._readonlyInput);
58334
58344
  this._readonlyInput.visible = !!value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.12.29",
3
+ "version": "1.12.31",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {