lyb-pixi-js 1.12.45 → 1.12.47
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.
|
@@ -6,7 +6,7 @@ interface Params {
|
|
|
6
6
|
/** 高度 */
|
|
7
7
|
height: number;
|
|
8
8
|
/** 字体与高度比 */
|
|
9
|
-
fontSizeRatio
|
|
9
|
+
fontSizeRatio?: number;
|
|
10
10
|
/** 使用字体 */
|
|
11
11
|
fontFamily?: string;
|
|
12
12
|
/** 是否加粗 */
|
|
@@ -59,12 +59,12 @@ export declare class LibPixiInput extends LibPixiContainer {
|
|
|
59
59
|
constructor(params: Params);
|
|
60
60
|
/** @description 设置值 */
|
|
61
61
|
setValue(v: string): void;
|
|
62
|
+
/** @description 聚焦 */
|
|
63
|
+
focus(): void;
|
|
62
64
|
/** @description 创建输入框 */
|
|
63
65
|
private _createInput;
|
|
64
66
|
/** @description 创建只读输入框 */
|
|
65
67
|
private _createReadOnlyInput;
|
|
66
|
-
/** @description 聚焦 */
|
|
67
|
-
private _focus;
|
|
68
68
|
/** @description 失焦 */
|
|
69
69
|
private _blur;
|
|
70
70
|
/** @description 失去焦点处理 */
|
|
@@ -41,7 +41,7 @@ export class LibPixiInput extends LibPixiContainer {
|
|
|
41
41
|
this._createInput();
|
|
42
42
|
this._createReadOnlyInput();
|
|
43
43
|
//聚焦
|
|
44
|
-
libPixiEvent(this, "pointertap", this.
|
|
44
|
+
libPixiEvent(this, "pointertap", this.focus.bind(this));
|
|
45
45
|
const ticker = new Ticker();
|
|
46
46
|
ticker.add(() => {
|
|
47
47
|
if (this.destroyed) {
|
|
@@ -65,6 +65,20 @@ export class LibPixiInput extends LibPixiContainer {
|
|
|
65
65
|
this._readonlyInput.text = (onFormatValue === null || onFormatValue === void 0 ? void 0 : onFormatValue(value)) || value;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
/** @description 聚焦 */
|
|
69
|
+
focus() {
|
|
70
|
+
const { type } = this._params;
|
|
71
|
+
this._input.style.display = "block";
|
|
72
|
+
this._input.focus();
|
|
73
|
+
this._readonlyInput.visible = false;
|
|
74
|
+
this._placeholder.visible = false;
|
|
75
|
+
if (type === "number") {
|
|
76
|
+
this._input.value = this._value && Number(this._value).toString();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this._input.value = this._value;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
68
82
|
/** @description 创建输入框 */
|
|
69
83
|
_createInput() {
|
|
70
84
|
const { color = "#fff", maxLength = 999999, align = "left", type = "text", onInput = () => { }, fontFamily = "", bold = false, } = this._params;
|
|
@@ -127,20 +141,6 @@ export class LibPixiInput extends LibPixiContainer {
|
|
|
127
141
|
this._readonlyInput.anchor.set(align === "left" ? 0 : 0.5, 0.5);
|
|
128
142
|
this._readonlyInput.position.set(align === "left" ? 0 : width / 2, height / 2);
|
|
129
143
|
}
|
|
130
|
-
/** @description 聚焦 */
|
|
131
|
-
_focus() {
|
|
132
|
-
const { type } = this._params;
|
|
133
|
-
this._input.style.display = "block";
|
|
134
|
-
this._input.focus();
|
|
135
|
-
this._readonlyInput.visible = false;
|
|
136
|
-
this._placeholder.visible = false;
|
|
137
|
-
if (type === "number") {
|
|
138
|
-
this._input.value = this._value && Number(this._value).toString();
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
this._input.value = this._value;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
144
|
/** @description 失焦 */
|
|
145
145
|
_blur() {
|
|
146
146
|
const { onValue, width } = this._params;
|