@next2d/text 1.18.12 → 2.0.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.
- package/package.json +14 -18
- package/src/TextArea/service/TextAreaMovePositionService.d.ts +11 -0
- package/src/TextArea/service/TextAreaMovePositionService.js +42 -0
- package/src/TextArea/usecase/TextAreaCompositionEndUseCase.d.ts +9 -0
- package/src/TextArea/usecase/TextAreaCompositionEndUseCase.js +17 -0
- package/src/TextArea/usecase/TextAreaCompositionStartUseCase.d.ts +9 -0
- package/src/TextArea/usecase/TextAreaCompositionStartUseCase.js +17 -0
- package/src/TextArea/usecase/TextAreaCompositionUpdateUseCase.d.ts +10 -0
- package/src/TextArea/usecase/TextAreaCompositionUpdateUseCase.js +18 -0
- package/src/TextArea/usecase/TextAreaInputUseCase.d.ts +10 -0
- package/src/TextArea/usecase/TextAreaInputUseCase.js +25 -0
- package/src/TextArea/usecase/TextAreaRegisterEventUseCase.d.ts +10 -0
- package/src/TextArea/usecase/TextAreaRegisterEventUseCase.js +21 -0
- package/src/TextData.d.ts +103 -0
- package/src/TextData.js +183 -0
- package/src/TextField/service/TextFieldApplyChangesService.d.ts +11 -0
- package/src/TextField/service/TextFieldApplyChangesService.js +16 -0
- package/src/TextField/service/TextFieldBlinkingClearTimeoutService.d.ts +9 -0
- package/src/TextField/service/TextFieldBlinkingClearTimeoutService.js +16 -0
- package/src/TextField/service/TextFieldCompositionStartService.d.ts +11 -0
- package/src/TextField/service/TextFieldCompositionStartService.js +12 -0
- package/src/TextField/service/TextFieldPasteService.d.ts +11 -0
- package/src/TextField/service/TextFieldPasteService.js +16 -0
- package/src/TextField/usecase/TextFieldArrowDownUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldArrowDownUseCase.js +191 -0
- package/src/TextField/usecase/TextFieldArrowLeftUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldArrowLeftUseCase.js +98 -0
- package/src/TextField/usecase/TextFieldArrowRightUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldArrowRightUseCase.js +92 -0
- package/src/TextField/usecase/TextFieldArrowUpUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldArrowUpUseCase.js +156 -0
- package/src/TextField/usecase/TextFieldBlinkingUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldBlinkingUseCase.js +21 -0
- package/src/TextField/usecase/TextFieldBuildFromCharacterUseCase.d.ts +13 -0
- package/src/TextField/usecase/TextFieldBuildFromCharacterUseCase.js +58 -0
- package/src/TextField/usecase/TextFieldCompositionEndUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldCompositionEndUseCase.js +32 -0
- package/src/TextField/usecase/TextFieldCompositionUpdateUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldCompositionUpdateUseCase.js +109 -0
- package/src/TextField/usecase/TextFieldCopyUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldCopyUseCase.js +38 -0
- package/src/TextField/usecase/TextFieldDeleteTextUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldDeleteTextUseCase.js +108 -0
- package/src/TextField/usecase/TextFieldGetLineTextUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldGetLineTextUseCase.js +32 -0
- package/src/TextField/usecase/TextFieldGetTextDataUseCase.d.ts +15 -0
- package/src/TextField/usecase/TextFieldGetTextDataUseCase.js +26 -0
- package/src/TextField/usecase/TextFieldHtmlTextToRawTextUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldHtmlTextToRawTextUseCase.js +31 -0
- package/src/TextField/usecase/TextFieldInsertTextUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldInsertTextUseCase.js +79 -0
- package/src/TextField/usecase/TextFieldKeyDownEventUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldKeyDownEventUseCase.js +60 -0
- package/src/TextField/usecase/TextFieldReloadUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldReloadUseCase.js +25 -0
- package/src/TextField/usecase/TextFieldReplaceTextUseCase.d.ts +14 -0
- package/src/TextField/usecase/TextFieldReplaceTextUseCase.js +24 -0
- package/src/TextField/usecase/TextFieldResetUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldResetUseCase.js +20 -0
- package/src/TextField/usecase/TextFieldResizeAutoFontSizeUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldResizeAutoFontSizeUseCase.js +37 -0
- package/src/TextField/usecase/TextFieldResizeUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldResizeUseCase.js +49 -0
- package/src/TextField/usecase/TextFieldSelectAllUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldSelectAllUseCase.js +20 -0
- package/src/TextField/usecase/TextFieldSelectedFocusMoveUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldSelectedFocusMoveUseCase.js +90 -0
- package/src/TextField/usecase/TextFieldSetFocusIndexUseCase.d.ts +14 -0
- package/src/TextField/usecase/TextFieldSetFocusIndexUseCase.js +197 -0
- package/src/TextField/usecase/TextFieldSetFocusUseCase.d.ts +11 -0
- package/src/TextField/usecase/TextFieldSetFocusUseCase.js +43 -0
- package/src/TextField/usecase/TextFieldSetScrollXUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldSetScrollXUseCase.js +66 -0
- package/src/TextField/usecase/TextFieldSetScrollYUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldSetScrollYUseCase.js +66 -0
- package/src/TextField/usecase/TextFieldUpdateStopIndexUseCase.d.ts +12 -0
- package/src/TextField/usecase/TextFieldUpdateStopIndexUseCase.js +82 -0
- package/src/TextField.d.ts +602 -0
- package/src/TextField.js +1292 -0
- package/src/TextFormat/service/TextFormatGenerateFontStyleService.d.ts +11 -0
- package/src/TextFormat/service/TextFormatGenerateFontStyleService.js +19 -0
- package/src/TextFormat/service/TextFormatGetWidthMarginService.d.ts +11 -0
- package/src/TextFormat/service/TextFormatGetWidthMarginService.js +19 -0
- package/src/TextFormat/service/TextFormatHtmlTextGenerateStyleService.d.ts +11 -0
- package/src/TextFormat/service/TextFormatHtmlTextGenerateStyleService.js +51 -0
- package/src/TextFormat/service/TextFormatIsSameService.d.ts +12 -0
- package/src/TextFormat/service/TextFormatIsSameService.js +28 -0
- package/src/TextFormat/service/TextFormatSetDefaultService.d.ts +11 -0
- package/src/TextFormat/service/TextFormatSetDefaultService.js +22 -0
- package/{dist → src}/TextFormat.d.ts +42 -128
- package/src/TextFormat.js +233 -0
- package/src/TextParser/service/TextParserAdjustmentHeightService.d.ts +11 -0
- package/src/TextParser/service/TextParserAdjustmentHeightService.js +24 -0
- package/src/TextParser/service/TextParserParseStyleService.d.ts +11 -0
- package/src/TextParser/service/TextParserParseStyleService.js +80 -0
- package/src/TextParser/usecase/TextParserCreateNewLineUseCase.d.ts +13 -0
- package/src/TextParser/usecase/TextParserCreateNewLineUseCase.js +35 -0
- package/src/TextParser/usecase/TextParserParseHtmlTextUseCase.d.ts +15 -0
- package/src/TextParser/usecase/TextParserParseHtmlTextUseCase.js +37 -0
- package/src/TextParser/usecase/TextParserParseTagUseCase.d.ts +17 -0
- package/src/TextParser/usecase/TextParserParseTagUseCase.js +57 -0
- package/src/TextParser/usecase/TextParserParseTextUseCase.d.ts +16 -0
- package/src/TextParser/usecase/TextParserParseTextUseCase.js +140 -0
- package/src/TextParser/usecase/TextParserSetAttributesUseCase.d.ts +14 -0
- package/src/TextParser/usecase/TextParserSetAttributesUseCase.js +63 -0
- package/src/TextUtil.d.ts +114 -0
- package/src/TextUtil.js +186 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +3 -0
- package/src/interface/IAttributeObject.d.ts +4 -0
- package/src/interface/IBlendMode.d.ts +1 -0
- package/src/interface/IBounds.d.ts +6 -0
- package/src/interface/ICharacter.d.ts +5 -0
- package/src/interface/ICharacter.js +1 -0
- package/src/interface/IDictionaryTag.d.ts +8 -0
- package/src/interface/IDictionaryTag.js +1 -0
- package/src/interface/IElementPosition.d.ts +4 -0
- package/src/interface/IElementPosition.js +1 -0
- package/src/interface/IFilterArray.d.ts +2 -0
- package/src/interface/IFilterArray.js +1 -0
- package/src/interface/IGrid.d.ts +6 -0
- package/src/interface/IGrid.js +1 -0
- package/src/interface/ILoopConfig.d.ts +8 -0
- package/src/interface/ILoopConfig.js +1 -0
- package/src/interface/ILoopType.d.ts +1 -0
- package/src/interface/ILoopType.js +1 -0
- package/src/interface/IMovieClipActionObject.d.ts +5 -0
- package/src/interface/IMovieClipActionObject.js +1 -0
- package/src/interface/IMovieClipCharacter.d.ts +17 -0
- package/src/interface/IMovieClipCharacter.js +1 -0
- package/src/interface/IMovieClipLabelObject.d.ts +4 -0
- package/src/interface/IMovieClipLabelObject.js +1 -0
- package/src/interface/IMovieClipSoundObject.d.ts +5 -0
- package/src/interface/IMovieClipSoundObject.js +1 -0
- package/src/interface/IOptions.d.ts +8 -0
- package/src/interface/IOptions.js +1 -0
- package/src/interface/IPlaceObject.d.ts +14 -0
- package/src/interface/IPlaceObject.js +1 -0
- package/src/interface/IRGBA.d.ts +6 -0
- package/src/interface/IRGBA.js +1 -0
- package/src/interface/IShapeCharacter.d.ts +14 -0
- package/src/interface/IShapeCharacter.js +1 -0
- package/src/interface/ISoundTag.d.ts +6 -0
- package/src/interface/ISoundTag.js +1 -0
- package/src/interface/ISurfaceFilter.d.ts +6 -0
- package/src/interface/ISurfaceFilter.js +1 -0
- package/src/interface/ITextFieldAutoSize.d.ts +1 -0
- package/src/interface/ITextFieldAutoSize.js +1 -0
- package/src/interface/ITextFieldCharacter copy.d.ts +26 -0
- package/src/interface/ITextFieldCharacter copy.js +1 -0
- package/src/interface/ITextFieldCharacter.d.ts +26 -0
- package/src/interface/ITextFieldCharacter.js +1 -0
- package/src/interface/ITextFieldType copy.d.ts +1 -0
- package/src/interface/ITextFieldType copy.js +1 -0
- package/src/interface/ITextFieldType.d.ts +1 -0
- package/src/interface/ITextFieldType.js +1 -0
- package/src/interface/ITextFormatAlign copy.d.ts +1 -0
- package/src/interface/ITextFormatAlign copy.js +1 -0
- package/src/interface/ITextFormatAlign.d.ts +1 -0
- package/src/interface/ITextFormatAlign.js +1 -0
- package/src/interface/ITextFormatObject.d.ts +14 -0
- package/src/interface/ITextFormatObject.js +1 -0
- package/src/interface/ITextObject.d.ts +12 -0
- package/src/interface/ITextObject.js +1 -0
- package/src/interface/ITextObjectMode.d.ts +1 -0
- package/src/interface/ITextObjectMode.js +1 -0
- package/src/interface/IVideoCharacter.d.ts +11 -0
- package/src/interface/IVideoCharacter.js +1 -0
- package/dist/TextData.d.ts +0 -74
- package/dist/TextData.js +0 -132
- package/dist/TextFormat.js +0 -493
- package/dist/TextParser.d.ts +0 -23
- package/dist/TextParser.js +0 -459
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/interface/OptionsImpl.d.ts +0 -8
- package/dist/interface/TextObjectImpl.d.ts +0 -12
- package/dist/interface/TextObjectModeImpl.d.ts +0 -1
- /package/{dist/interface/OptionsImpl.js → src/interface/IAttributeObject.js} +0 -0
- /package/{dist/interface/TextObjectImpl.js → src/interface/IBlendMode.js} +0 -0
- /package/{dist/interface/TextObjectModeImpl.js → src/interface/IBounds.js} +0 -0
package/src/TextField.js
ADDED
|
@@ -0,0 +1,1292 @@
|
|
|
1
|
+
import { FocusEvent } from "@next2d/events";
|
|
2
|
+
import { Rectangle } from "@next2d/geom";
|
|
3
|
+
import { TextFormat } from "./TextFormat";
|
|
4
|
+
import { execute as textFormatSetDefaultService } from "./TextFormat/service/TextFormatSetDefaultService";
|
|
5
|
+
import { execute as textFormatHtmlTextGenerateStyleService } from "./TextFormat/service/TextFormatHtmlTextGenerateStyleService";
|
|
6
|
+
import { execute as textFieldGetTextDataUseCase } from "./TextField/usecase/TextFieldGetTextDataUseCase";
|
|
7
|
+
import { execute as textFieldReloadUseCase } from "./TextField/usecase/TextFieldReloadUseCase";
|
|
8
|
+
import { execute as textFieldUpdateStopIndexUseCase } from "./TextField/usecase/TextFieldUpdateStopIndexUseCase";
|
|
9
|
+
import { execute as textFieldSetFocusUseCase } from "./TextField/usecase/TextFieldSetFocusUseCase";
|
|
10
|
+
import { execute as textFieldSetScrollXUseCase } from "./TextField/usecase/TextFieldSetScrollXUseCase";
|
|
11
|
+
import { execute as textFieldSetScrollYUseCase } from "./TextField/usecase/TextFieldSetScrollYUseCase";
|
|
12
|
+
import { execute as textFieldHtmlTextToRawTextUseCase } from "./TextField/usecase/TextFieldHtmlTextToRawTextUseCase";
|
|
13
|
+
import { execute as textFieldGetLineTextUseCase } from "./TextField/usecase/TextFieldGetLineTextUseCase";
|
|
14
|
+
import { execute as textFieldReplaceTextUseCase } from "./TextField/usecase/TextFieldReplaceTextUseCase";
|
|
15
|
+
import { execute as textFieldCopyUseCase } from "./TextField/usecase/TextFieldCopyUseCase";
|
|
16
|
+
import { execute as textFieldPasteService } from "./TextField/service/TextFieldPasteService";
|
|
17
|
+
import { execute as textFieldInsertTextUseCase } from "./TextField/usecase/TextFieldInsertTextUseCase";
|
|
18
|
+
import { execute as textFieldApplyChangesService } from "./TextField/service/TextFieldApplyChangesService";
|
|
19
|
+
import { execute as textFieldSetFocusIndexUseCase } from "./TextField/usecase/TextFieldSetFocusIndexUseCase";
|
|
20
|
+
import { execute as textFieldKeyDownEventUseCase } from "./TextField/usecase/TextFieldKeyDownEventUseCase";
|
|
21
|
+
import { execute as textFieldDeleteTextUseCase } from "./TextField/usecase/TextFieldDeleteTextUseCase";
|
|
22
|
+
import { execute as textFieldSelectAllUseCase } from "./TextField/usecase/TextFieldSelectAllUseCase";
|
|
23
|
+
import { execute as textFieldBuildFromCharacterUseCase } from "./TextField/usecase/TextFieldBuildFromCharacterUseCase";
|
|
24
|
+
import { $clamp, $toColorInt } from "./TextUtil";
|
|
25
|
+
import { InteractiveObject, Shape } from "@next2d/display";
|
|
26
|
+
/**
|
|
27
|
+
* @description TextField クラスは、テキストの表示と入力用の表示オブジェクトを作成するために使用されます。
|
|
28
|
+
* プロパティインスペクターを使用して、テキストフィールドにインスタンス名を付けることができます。
|
|
29
|
+
* また、TextField クラスのメソッドとプロパティを使用して、JavaScript でテキストフィールドを操作できます。
|
|
30
|
+
*
|
|
31
|
+
* The TextField class is used to create display objects for text display and input.
|
|
32
|
+
* You can give a text field an instance name in the Property inspector
|
|
33
|
+
* nd use the methods and properties of the TextField class to manipulate it with JavaScript.
|
|
34
|
+
*
|
|
35
|
+
* @class
|
|
36
|
+
* @memberOf next2d.display
|
|
37
|
+
* @extends InteractiveObject
|
|
38
|
+
*/
|
|
39
|
+
export class TextField extends InteractiveObject {
|
|
40
|
+
/**
|
|
41
|
+
* @constructor
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
/**
|
|
47
|
+
* @description TextFieldの機能を所持しているかを返却
|
|
48
|
+
* Returns whether the display object has TextField functionality.
|
|
49
|
+
*
|
|
50
|
+
* @type {boolean}
|
|
51
|
+
* @readonly
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
Object.defineProperty(this, "isText", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: void 0
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* @description セットされたテキストを描画用に分解したデータ
|
|
62
|
+
* Data that breaks down the set text for drawing
|
|
63
|
+
*
|
|
64
|
+
* @member {TextData}
|
|
65
|
+
* @protected
|
|
66
|
+
*/
|
|
67
|
+
Object.defineProperty(this, "$textData", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: void 0
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* @description テキストが HTML であるかどうかを示します。
|
|
75
|
+
* Indicates whether the text is HTML.
|
|
76
|
+
*
|
|
77
|
+
* @member {boolean}
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
Object.defineProperty(this, "_$isHTML", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
configurable: true,
|
|
83
|
+
writable: true,
|
|
84
|
+
value: void 0
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* @description バウンディングボックスのxMin座標
|
|
88
|
+
* Bounding box coordinates
|
|
89
|
+
*
|
|
90
|
+
* @member {number}
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
Object.defineProperty(this, "xMin", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
configurable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: void 0
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* @description バウンディングボックスのyMin座標
|
|
101
|
+
* Bounding box coordinates
|
|
102
|
+
*
|
|
103
|
+
* @member {number}
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
Object.defineProperty(this, "yMin", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true,
|
|
110
|
+
value: void 0
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* @description バウンディングボックスのxMax座標
|
|
114
|
+
* Bounding box coordinates
|
|
115
|
+
*
|
|
116
|
+
* @member {number}
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
Object.defineProperty(this, "xMax", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
configurable: true,
|
|
122
|
+
writable: true,
|
|
123
|
+
value: void 0
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* @description バウンディングボックスのyMax座標
|
|
127
|
+
* Bounding box coordinates
|
|
128
|
+
*
|
|
129
|
+
* @member {number}
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
Object.defineProperty(this, "yMax", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
configurable: true,
|
|
135
|
+
writable: true,
|
|
136
|
+
value: void 0
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* @description テキストフィールドの描画範囲のバウンディングボックス
|
|
140
|
+
* The bounding box of the drawing area of the text field
|
|
141
|
+
*
|
|
142
|
+
* @member {IBounds}
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
Object.defineProperty(this, "bounds", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
configurable: true,
|
|
148
|
+
writable: true,
|
|
149
|
+
value: void 0
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* @description スクロール機能のON/OFFの制御。
|
|
153
|
+
* Control ON/OFF of the scroll function.
|
|
154
|
+
*
|
|
155
|
+
* @member {boolean}
|
|
156
|
+
* @default true
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
Object.defineProperty(this, "scrollEnabled", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
configurable: true,
|
|
162
|
+
writable: true,
|
|
163
|
+
value: void 0
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* @description xスクロールバーの表示用の Shape オブジェクト
|
|
167
|
+
* Shape object for x scroll bar display
|
|
168
|
+
*
|
|
169
|
+
* @member {Shape}
|
|
170
|
+
* @protected
|
|
171
|
+
*/
|
|
172
|
+
Object.defineProperty(this, "xScrollShape", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
configurable: true,
|
|
175
|
+
writable: true,
|
|
176
|
+
value: void 0
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* @description yスクロールバーの表示用の Shape オブジェクト
|
|
180
|
+
* Shape object for y scroll bar display
|
|
181
|
+
*
|
|
182
|
+
* @member {Shape | null}
|
|
183
|
+
* @protected
|
|
184
|
+
*/
|
|
185
|
+
Object.defineProperty(this, "yScrollShape", {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
configurable: true,
|
|
188
|
+
writable: true,
|
|
189
|
+
value: void 0
|
|
190
|
+
});
|
|
191
|
+
/**
|
|
192
|
+
* @description テキストフィールドの点滅線の表示・非表示を制御します。
|
|
193
|
+
* Controls the visibility of the text field's blinking line.
|
|
194
|
+
*
|
|
195
|
+
* @member {boolean}
|
|
196
|
+
* @default false
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
199
|
+
Object.defineProperty(this, "focusVisible", {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
configurable: true,
|
|
202
|
+
writable: true,
|
|
203
|
+
value: void 0
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* @description テキストフィールドのフォーカス位置のインデックス
|
|
207
|
+
* Index of the focus position of the text field
|
|
208
|
+
*
|
|
209
|
+
* @member {number}
|
|
210
|
+
* @default -1
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
213
|
+
Object.defineProperty(this, "focusIndex", {
|
|
214
|
+
enumerable: true,
|
|
215
|
+
configurable: true,
|
|
216
|
+
writable: true,
|
|
217
|
+
value: void 0
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* @description テキストフィールドの選択位置のインデックス
|
|
221
|
+
* Index of the selected position of the text field
|
|
222
|
+
*
|
|
223
|
+
* @member {number}
|
|
224
|
+
* @default -1
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
Object.defineProperty(this, "selectIndex", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
configurable: true,
|
|
230
|
+
writable: true,
|
|
231
|
+
value: void 0
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* @description ユーザーが入力するときに、テキストフィールドに入力できる最大の文字数です。
|
|
235
|
+
* The maximum number of characters that the text field can contain,
|
|
236
|
+
* as entered by a user.
|
|
237
|
+
*
|
|
238
|
+
* @member {number}
|
|
239
|
+
* @default 0
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
Object.defineProperty(this, "maxChars", {
|
|
243
|
+
enumerable: true,
|
|
244
|
+
configurable: true,
|
|
245
|
+
writable: true,
|
|
246
|
+
value: void 0
|
|
247
|
+
});
|
|
248
|
+
/**
|
|
249
|
+
* @description ユーザーがテキストフィールドに入力できる文字のセットを指定します。
|
|
250
|
+
* Indicates the set of characters that a user can enter into the text field.
|
|
251
|
+
*
|
|
252
|
+
* @member {string}
|
|
253
|
+
* @default null
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
Object.defineProperty(this, "restrict", {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
configurable: true,
|
|
259
|
+
writable: true,
|
|
260
|
+
value: void 0
|
|
261
|
+
});
|
|
262
|
+
/**
|
|
263
|
+
* @description テキストフィールドのタイプです。
|
|
264
|
+
* The type of the text field.
|
|
265
|
+
*
|
|
266
|
+
* @member {string}
|
|
267
|
+
* @default TextFieldType.STATIC
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
Object.defineProperty(this, "type", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
configurable: true,
|
|
273
|
+
writable: true,
|
|
274
|
+
value: void 0
|
|
275
|
+
});
|
|
276
|
+
/**
|
|
277
|
+
* @description テキストフィールドのコンポジション開始インデックス
|
|
278
|
+
* Composition start index of the text field
|
|
279
|
+
*
|
|
280
|
+
* @member {number}
|
|
281
|
+
* @default -1
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
Object.defineProperty(this, "compositionStartIndex", {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
configurable: true,
|
|
287
|
+
writable: true,
|
|
288
|
+
value: void 0
|
|
289
|
+
});
|
|
290
|
+
/**
|
|
291
|
+
* @description テキストフィールドのコンポジション終了インデックス
|
|
292
|
+
* Composition end index of the text field
|
|
293
|
+
*
|
|
294
|
+
* @member {number}
|
|
295
|
+
* @default -1
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
Object.defineProperty(this, "compositionEndIndex", {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
configurable: true,
|
|
301
|
+
writable: true,
|
|
302
|
+
value: void 0
|
|
303
|
+
});
|
|
304
|
+
/**
|
|
305
|
+
* @description テキストフィールドのテキストフォーマットの配列です。
|
|
306
|
+
* An array of text formats for the text field.
|
|
307
|
+
*
|
|
308
|
+
* @member {TextFormat[]}
|
|
309
|
+
* @default null
|
|
310
|
+
* @protected
|
|
311
|
+
*/
|
|
312
|
+
Object.defineProperty(this, "$textFormats", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
configurable: true,
|
|
315
|
+
writable: true,
|
|
316
|
+
value: void 0
|
|
317
|
+
});
|
|
318
|
+
/**
|
|
319
|
+
* @description x軸のスクロール位置
|
|
320
|
+
* Scroll position on the x-axis
|
|
321
|
+
*
|
|
322
|
+
* @member {number}
|
|
323
|
+
* @default 0
|
|
324
|
+
* @protected
|
|
325
|
+
*/
|
|
326
|
+
Object.defineProperty(this, "$scrollX", {
|
|
327
|
+
enumerable: true,
|
|
328
|
+
configurable: true,
|
|
329
|
+
writable: true,
|
|
330
|
+
value: void 0
|
|
331
|
+
});
|
|
332
|
+
/**
|
|
333
|
+
* @description y軸のスクロール位置
|
|
334
|
+
* Scroll position on the y-axis
|
|
335
|
+
*
|
|
336
|
+
* @member {number}
|
|
337
|
+
* @default 0
|
|
338
|
+
* @protected
|
|
339
|
+
*/
|
|
340
|
+
Object.defineProperty(this, "$scrollY", {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
configurable: true,
|
|
343
|
+
writable: true,
|
|
344
|
+
value: void 0
|
|
345
|
+
});
|
|
346
|
+
/**
|
|
347
|
+
* @description ビルドされたキャッシュキー
|
|
348
|
+
* Built cache key
|
|
349
|
+
*
|
|
350
|
+
* @type {number}
|
|
351
|
+
* @default 0
|
|
352
|
+
* @public
|
|
353
|
+
*/
|
|
354
|
+
Object.defineProperty(this, "cacheKey", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: true,
|
|
358
|
+
value: void 0
|
|
359
|
+
});
|
|
360
|
+
/**
|
|
361
|
+
* @description キャッシュのビルドに利用されるパラメータ
|
|
362
|
+
* Parameters used to build the cache
|
|
363
|
+
*
|
|
364
|
+
* @type {number[]}
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
Object.defineProperty(this, "cacheParams", {
|
|
368
|
+
enumerable: true,
|
|
369
|
+
configurable: true,
|
|
370
|
+
writable: true,
|
|
371
|
+
value: void 0
|
|
372
|
+
});
|
|
373
|
+
Object.defineProperty(this, "_$background", {
|
|
374
|
+
enumerable: true,
|
|
375
|
+
configurable: true,
|
|
376
|
+
writable: true,
|
|
377
|
+
value: void 0
|
|
378
|
+
});
|
|
379
|
+
Object.defineProperty(this, "_$backgroundColor", {
|
|
380
|
+
enumerable: true,
|
|
381
|
+
configurable: true,
|
|
382
|
+
writable: true,
|
|
383
|
+
value: void 0
|
|
384
|
+
});
|
|
385
|
+
Object.defineProperty(this, "_$border", {
|
|
386
|
+
enumerable: true,
|
|
387
|
+
configurable: true,
|
|
388
|
+
writable: true,
|
|
389
|
+
value: void 0
|
|
390
|
+
});
|
|
391
|
+
Object.defineProperty(this, "_$borderColor", {
|
|
392
|
+
enumerable: true,
|
|
393
|
+
configurable: true,
|
|
394
|
+
writable: true,
|
|
395
|
+
value: void 0
|
|
396
|
+
});
|
|
397
|
+
Object.defineProperty(this, "_$htmlText", {
|
|
398
|
+
enumerable: true,
|
|
399
|
+
configurable: true,
|
|
400
|
+
writable: true,
|
|
401
|
+
value: void 0
|
|
402
|
+
});
|
|
403
|
+
Object.defineProperty(this, "_$multiline", {
|
|
404
|
+
enumerable: true,
|
|
405
|
+
configurable: true,
|
|
406
|
+
writable: true,
|
|
407
|
+
value: void 0
|
|
408
|
+
});
|
|
409
|
+
Object.defineProperty(this, "_$text", {
|
|
410
|
+
enumerable: true,
|
|
411
|
+
configurable: true,
|
|
412
|
+
writable: true,
|
|
413
|
+
value: void 0
|
|
414
|
+
});
|
|
415
|
+
Object.defineProperty(this, "_$wordWrap", {
|
|
416
|
+
enumerable: true,
|
|
417
|
+
configurable: true,
|
|
418
|
+
writable: true,
|
|
419
|
+
value: void 0
|
|
420
|
+
});
|
|
421
|
+
Object.defineProperty(this, "_$defaultTextFormat", {
|
|
422
|
+
enumerable: true,
|
|
423
|
+
configurable: true,
|
|
424
|
+
writable: true,
|
|
425
|
+
value: void 0
|
|
426
|
+
});
|
|
427
|
+
Object.defineProperty(this, "_$rawHtmlText", {
|
|
428
|
+
enumerable: true,
|
|
429
|
+
configurable: true,
|
|
430
|
+
writable: true,
|
|
431
|
+
value: void 0
|
|
432
|
+
});
|
|
433
|
+
Object.defineProperty(this, "_$autoSize", {
|
|
434
|
+
enumerable: true,
|
|
435
|
+
configurable: true,
|
|
436
|
+
writable: true,
|
|
437
|
+
value: void 0
|
|
438
|
+
});
|
|
439
|
+
Object.defineProperty(this, "_$autoFontSize", {
|
|
440
|
+
enumerable: true,
|
|
441
|
+
configurable: true,
|
|
442
|
+
writable: true,
|
|
443
|
+
value: void 0
|
|
444
|
+
});
|
|
445
|
+
Object.defineProperty(this, "_$focus", {
|
|
446
|
+
enumerable: true,
|
|
447
|
+
configurable: true,
|
|
448
|
+
writable: true,
|
|
449
|
+
value: void 0
|
|
450
|
+
});
|
|
451
|
+
Object.defineProperty(this, "_$thickness", {
|
|
452
|
+
enumerable: true,
|
|
453
|
+
configurable: true,
|
|
454
|
+
writable: true,
|
|
455
|
+
value: void 0
|
|
456
|
+
});
|
|
457
|
+
Object.defineProperty(this, "_$thicknessColor", {
|
|
458
|
+
enumerable: true,
|
|
459
|
+
configurable: true,
|
|
460
|
+
writable: true,
|
|
461
|
+
value: void 0
|
|
462
|
+
});
|
|
463
|
+
Object.defineProperty(this, "_$stopIndex", {
|
|
464
|
+
enumerable: true,
|
|
465
|
+
configurable: true,
|
|
466
|
+
writable: true,
|
|
467
|
+
value: void 0
|
|
468
|
+
});
|
|
469
|
+
this.isText = true;
|
|
470
|
+
/**
|
|
471
|
+
* @type {TextData}
|
|
472
|
+
* @default null
|
|
473
|
+
* @public
|
|
474
|
+
*/
|
|
475
|
+
this.$textData = null;
|
|
476
|
+
/**
|
|
477
|
+
* @type {boolean}
|
|
478
|
+
* @default false
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
this._$background = false;
|
|
482
|
+
/**
|
|
483
|
+
* @type {number}
|
|
484
|
+
* @default 0xffffff
|
|
485
|
+
* @private
|
|
486
|
+
*/
|
|
487
|
+
this._$backgroundColor = 0xffffff;
|
|
488
|
+
/**
|
|
489
|
+
* @type {boolean}
|
|
490
|
+
* @default false
|
|
491
|
+
* @private
|
|
492
|
+
*/
|
|
493
|
+
this._$border = false;
|
|
494
|
+
/**
|
|
495
|
+
* @type {number}
|
|
496
|
+
* @default 0x000000
|
|
497
|
+
* @private
|
|
498
|
+
*/
|
|
499
|
+
this._$borderColor = 0x000000;
|
|
500
|
+
/**
|
|
501
|
+
* @type {string}
|
|
502
|
+
* @default ""
|
|
503
|
+
* @private
|
|
504
|
+
*/
|
|
505
|
+
this._$htmlText = "";
|
|
506
|
+
/**
|
|
507
|
+
* @type {boolean}
|
|
508
|
+
* @default false
|
|
509
|
+
* @private
|
|
510
|
+
*/
|
|
511
|
+
this._$multiline = false;
|
|
512
|
+
/**
|
|
513
|
+
* @type {string}
|
|
514
|
+
* @default ""
|
|
515
|
+
* @private
|
|
516
|
+
*/
|
|
517
|
+
this._$text = "";
|
|
518
|
+
/**
|
|
519
|
+
* @type {boolean}
|
|
520
|
+
* @default false
|
|
521
|
+
* @private
|
|
522
|
+
*/
|
|
523
|
+
this._$wordWrap = false;
|
|
524
|
+
/**
|
|
525
|
+
* @type {number}
|
|
526
|
+
* @default 0
|
|
527
|
+
* @protected
|
|
528
|
+
*/
|
|
529
|
+
this.$scrollX = 0;
|
|
530
|
+
/**
|
|
531
|
+
* @type {number}
|
|
532
|
+
* @default 0
|
|
533
|
+
* @protected
|
|
534
|
+
*/
|
|
535
|
+
this.$scrollY = 0;
|
|
536
|
+
/**
|
|
537
|
+
* @type {array}
|
|
538
|
+
* @default null
|
|
539
|
+
* @protected
|
|
540
|
+
*/
|
|
541
|
+
this.$textFormats = null;
|
|
542
|
+
/**
|
|
543
|
+
* @type {number}
|
|
544
|
+
* @default 0
|
|
545
|
+
* @public
|
|
546
|
+
*/
|
|
547
|
+
this.maxChars = 0;
|
|
548
|
+
/**
|
|
549
|
+
* @type {number}
|
|
550
|
+
* @default -1
|
|
551
|
+
* @private
|
|
552
|
+
*/
|
|
553
|
+
this._$stopIndex = -1;
|
|
554
|
+
/**
|
|
555
|
+
* @type {number}
|
|
556
|
+
* @default -1
|
|
557
|
+
* @public
|
|
558
|
+
*/
|
|
559
|
+
this.compositionStartIndex = -1;
|
|
560
|
+
/**
|
|
561
|
+
* @type {number}
|
|
562
|
+
* @default -1
|
|
563
|
+
* @public
|
|
564
|
+
*/
|
|
565
|
+
this.compositionEndIndex = -1;
|
|
566
|
+
// TextFormat
|
|
567
|
+
const textFormat = new TextFormat();
|
|
568
|
+
textFormatSetDefaultService(textFormat);
|
|
569
|
+
/**
|
|
570
|
+
* @type {TextFormat}
|
|
571
|
+
* @private
|
|
572
|
+
*/
|
|
573
|
+
this._$defaultTextFormat = textFormat;
|
|
574
|
+
/**
|
|
575
|
+
* @type {string}
|
|
576
|
+
* @default ""
|
|
577
|
+
* @private
|
|
578
|
+
*/
|
|
579
|
+
this._$rawHtmlText = "";
|
|
580
|
+
/**
|
|
581
|
+
* @type {number}
|
|
582
|
+
* @default 0
|
|
583
|
+
* @public
|
|
584
|
+
*/
|
|
585
|
+
this.xMin = 0;
|
|
586
|
+
this.yMin = 0;
|
|
587
|
+
this.xMax = 100;
|
|
588
|
+
this.yMax = 100;
|
|
589
|
+
this.bounds = {
|
|
590
|
+
"xMin": 0,
|
|
591
|
+
"xMax": this.xMax,
|
|
592
|
+
"yMin": 0,
|
|
593
|
+
"yMax": this.yMax
|
|
594
|
+
};
|
|
595
|
+
/**
|
|
596
|
+
* @type {string}
|
|
597
|
+
* @default null
|
|
598
|
+
* @private
|
|
599
|
+
*/
|
|
600
|
+
this.restrict = "";
|
|
601
|
+
/**
|
|
602
|
+
* @type {boolean}
|
|
603
|
+
* @default false
|
|
604
|
+
* @private
|
|
605
|
+
*/
|
|
606
|
+
this._$isHTML = false;
|
|
607
|
+
/**
|
|
608
|
+
* @type {string}
|
|
609
|
+
* @default TextFieldAutoSize.NONE
|
|
610
|
+
* @private
|
|
611
|
+
*/
|
|
612
|
+
this._$autoSize = "none";
|
|
613
|
+
/**
|
|
614
|
+
* @type {boolean}
|
|
615
|
+
* @default false
|
|
616
|
+
* @private
|
|
617
|
+
*/
|
|
618
|
+
this._$autoFontSize = false;
|
|
619
|
+
/**
|
|
620
|
+
* @type {boolean}
|
|
621
|
+
* @default true
|
|
622
|
+
* @private
|
|
623
|
+
*/
|
|
624
|
+
this.focusVisible = false;
|
|
625
|
+
/**
|
|
626
|
+
* @type {number}
|
|
627
|
+
* @default -1
|
|
628
|
+
* @public
|
|
629
|
+
*/
|
|
630
|
+
this.focusIndex = -1;
|
|
631
|
+
/**
|
|
632
|
+
* @type {number}
|
|
633
|
+
* @default -1
|
|
634
|
+
* @public
|
|
635
|
+
*/
|
|
636
|
+
this.selectIndex = -1;
|
|
637
|
+
/**
|
|
638
|
+
* @type {boolean}
|
|
639
|
+
* @default true
|
|
640
|
+
* @public
|
|
641
|
+
*/
|
|
642
|
+
this.scrollEnabled = true;
|
|
643
|
+
/**
|
|
644
|
+
* @type {Shape}
|
|
645
|
+
* @public
|
|
646
|
+
*/
|
|
647
|
+
this.xScrollShape = new Shape();
|
|
648
|
+
this
|
|
649
|
+
.xScrollShape
|
|
650
|
+
.graphics
|
|
651
|
+
.beginFill("#000", 0.3)
|
|
652
|
+
.drawRoundRect(0, 0, 3, 3, 3);
|
|
653
|
+
this
|
|
654
|
+
.xScrollShape
|
|
655
|
+
.scale9Grid = new Rectangle(1.5, 1.5, 0.1, 0.1);
|
|
656
|
+
/**
|
|
657
|
+
* @type {Shape}
|
|
658
|
+
* @public
|
|
659
|
+
*/
|
|
660
|
+
this.yScrollShape = new Shape();
|
|
661
|
+
this
|
|
662
|
+
.yScrollShape
|
|
663
|
+
.graphics
|
|
664
|
+
.beginFill("#000", 0.3)
|
|
665
|
+
.drawRoundRect(0, 0, 3, 3, 3);
|
|
666
|
+
this
|
|
667
|
+
.yScrollShape
|
|
668
|
+
.scale9Grid = new Rectangle(1.5, 1.5, 0.1, 0.1);
|
|
669
|
+
/**
|
|
670
|
+
* @type {string}
|
|
671
|
+
* @default "static"
|
|
672
|
+
* @public
|
|
673
|
+
*/
|
|
674
|
+
this.type = "static";
|
|
675
|
+
/**
|
|
676
|
+
* @type {boolean}
|
|
677
|
+
* @default false
|
|
678
|
+
* @private
|
|
679
|
+
*/
|
|
680
|
+
this._$focus = false;
|
|
681
|
+
/**
|
|
682
|
+
* @type {number}
|
|
683
|
+
* @default 0
|
|
684
|
+
* @private
|
|
685
|
+
*/
|
|
686
|
+
this._$thickness = 0;
|
|
687
|
+
/**
|
|
688
|
+
* @type {number}
|
|
689
|
+
* @default 0
|
|
690
|
+
* @private
|
|
691
|
+
*/
|
|
692
|
+
this._$thicknessColor = 0;
|
|
693
|
+
/**
|
|
694
|
+
* @type {array}
|
|
695
|
+
* @default 0
|
|
696
|
+
* @public
|
|
697
|
+
*/
|
|
698
|
+
this.cacheKey = 0;
|
|
699
|
+
/**
|
|
700
|
+
* @type {array}
|
|
701
|
+
* @public
|
|
702
|
+
*/
|
|
703
|
+
this.cacheParams = [0, 0, 0];
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* @description 指定されたクラスの空間名を返します。
|
|
707
|
+
* Returns the space name of the specified class.
|
|
708
|
+
*
|
|
709
|
+
* @return {string}
|
|
710
|
+
* @default next2d.display.TextField
|
|
711
|
+
* @const
|
|
712
|
+
* @static
|
|
713
|
+
*/
|
|
714
|
+
static get namespace() {
|
|
715
|
+
return "next2d.display.TextField";
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* @description 指定されたオブジェクトの空間名を返します。
|
|
719
|
+
* Returns the space name of the specified object.
|
|
720
|
+
*
|
|
721
|
+
* @return {string}
|
|
722
|
+
* @default next2d.display.TextField
|
|
723
|
+
* @const
|
|
724
|
+
* @public
|
|
725
|
+
*/
|
|
726
|
+
get namespace() {
|
|
727
|
+
return "next2d.display.TextField";
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* @description テキストサイズの自動的な拡大 / 縮小および整列を制御します。
|
|
731
|
+
* Controls automatic sizing and alignment of text size.
|
|
732
|
+
*
|
|
733
|
+
* @member {boolean}
|
|
734
|
+
* @default false
|
|
735
|
+
* @public
|
|
736
|
+
*/
|
|
737
|
+
get autoFontSize() {
|
|
738
|
+
return this._$autoFontSize;
|
|
739
|
+
}
|
|
740
|
+
set autoFontSize(auto_font_size) {
|
|
741
|
+
if (auto_font_size === this._$autoFontSize) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
this._$autoFontSize = !!auto_font_size;
|
|
745
|
+
textFieldReloadUseCase(this);
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* @description テキストフィールドの自動的な拡大 / 縮小および整列を制御します。
|
|
749
|
+
* Controls automatic sizing and alignment of text fields.
|
|
750
|
+
*
|
|
751
|
+
* @member {string}
|
|
752
|
+
* @default "none"
|
|
753
|
+
* @public
|
|
754
|
+
*/
|
|
755
|
+
get autoSize() {
|
|
756
|
+
return this._$autoSize;
|
|
757
|
+
}
|
|
758
|
+
set autoSize(auto_size) {
|
|
759
|
+
if (auto_size === this._$autoSize) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
this._$autoSize = auto_size;
|
|
763
|
+
textFieldReloadUseCase(this);
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* @description テキストフィールドに背景の塗りつぶしがあるかどうかを指定します。
|
|
767
|
+
* Specifies whether the text field has a background fill.
|
|
768
|
+
*
|
|
769
|
+
* @member {boolean}
|
|
770
|
+
* @default false
|
|
771
|
+
* @public
|
|
772
|
+
*/
|
|
773
|
+
get background() {
|
|
774
|
+
return this._$background;
|
|
775
|
+
}
|
|
776
|
+
set background(background) {
|
|
777
|
+
if (background === this._$background) {
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
this._$background = !!background;
|
|
781
|
+
textFieldApplyChangesService(this);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* @description テキストフィールドの背景の色です。
|
|
785
|
+
* The color of the text field background.
|
|
786
|
+
*
|
|
787
|
+
* @member {number}
|
|
788
|
+
* @default 0xffffff
|
|
789
|
+
* @public
|
|
790
|
+
*/
|
|
791
|
+
get backgroundColor() {
|
|
792
|
+
return this._$backgroundColor;
|
|
793
|
+
}
|
|
794
|
+
set backgroundColor(background_color) {
|
|
795
|
+
background_color = $clamp($toColorInt(background_color), 0, 0xffffff, 0xffffff);
|
|
796
|
+
if (background_color === this._$backgroundColor) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
this._$backgroundColor = background_color;
|
|
800
|
+
textFieldApplyChangesService(this);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* @description テキストフィールドに境界線があるかどうかを指定します。
|
|
804
|
+
* Specifies whether the text field has a border.
|
|
805
|
+
*
|
|
806
|
+
* @member {boolean}
|
|
807
|
+
* @default false
|
|
808
|
+
* @public
|
|
809
|
+
*/
|
|
810
|
+
get border() {
|
|
811
|
+
return this._$border;
|
|
812
|
+
}
|
|
813
|
+
set border(border) {
|
|
814
|
+
if (border === this._$border) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
this._$border = !!border;
|
|
818
|
+
textFieldApplyChangesService(this);
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* @description テキストフィールドの境界線の色です。
|
|
822
|
+
* The color of the text field border.
|
|
823
|
+
*
|
|
824
|
+
* @member {number}
|
|
825
|
+
* @default 0x000000
|
|
826
|
+
* @public
|
|
827
|
+
*/
|
|
828
|
+
get borderColor() {
|
|
829
|
+
return this._$borderColor;
|
|
830
|
+
}
|
|
831
|
+
set borderColor(border_color) {
|
|
832
|
+
border_color = $clamp($toColorInt(border_color), 0, 0xffffff, 0);
|
|
833
|
+
if (border_color === this._$borderColor) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
this._$borderColor = border_color;
|
|
837
|
+
textFieldApplyChangesService(this);
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* @description テキストの任意の表示終了位置の設定
|
|
841
|
+
* Setting an arbitrary display end position for text.
|
|
842
|
+
*
|
|
843
|
+
* @member {number}
|
|
844
|
+
* @default -1
|
|
845
|
+
* @public
|
|
846
|
+
*/
|
|
847
|
+
get stopIndex() {
|
|
848
|
+
return this._$stopIndex;
|
|
849
|
+
}
|
|
850
|
+
set stopIndex(stop_index) {
|
|
851
|
+
stop_index |= 0;
|
|
852
|
+
if (this._$stopIndex === stop_index) {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
this._$stopIndex = stop_index;
|
|
856
|
+
textFieldUpdateStopIndexUseCase(this, stop_index);
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* @description テキストに適用するフォーマットを指定します。
|
|
860
|
+
* Specifies the formatting to be applied to the text.
|
|
861
|
+
*
|
|
862
|
+
* @member {TextFormat}
|
|
863
|
+
* @public
|
|
864
|
+
*/
|
|
865
|
+
get defaultTextFormat() {
|
|
866
|
+
return this._$defaultTextFormat.clone();
|
|
867
|
+
}
|
|
868
|
+
set defaultTextFormat(text_format) {
|
|
869
|
+
this._$rawHtmlText = "";
|
|
870
|
+
if (this._$isHTML) {
|
|
871
|
+
this._$text = "";
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
this._$htmlText = "";
|
|
875
|
+
}
|
|
876
|
+
this._$defaultTextFormat = text_format;
|
|
877
|
+
textFieldReloadUseCase(this);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* @description このオブジェクトでマウスまたはその他のユーザー入力メッセージを
|
|
881
|
+
*
|
|
882
|
+
* @member {boolean}
|
|
883
|
+
* @default false
|
|
884
|
+
* @public
|
|
885
|
+
*/
|
|
886
|
+
get focus() {
|
|
887
|
+
return this._$focus;
|
|
888
|
+
}
|
|
889
|
+
set focus(focus) {
|
|
890
|
+
if (this._$focus === focus) {
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
if (this.type !== "input") {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
this._$focus = !!focus;
|
|
897
|
+
textFieldSetFocusUseCase(this, this._$focus ? FocusEvent.FOCUS_IN : FocusEvent.FOCUS_OUT);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* @description テキストフィールドの内容を HTML で表します。
|
|
901
|
+
* Contains the HTML representation of the text field contents.
|
|
902
|
+
*
|
|
903
|
+
* @member {string}
|
|
904
|
+
* @default ""
|
|
905
|
+
* @public
|
|
906
|
+
*/
|
|
907
|
+
get htmlText() {
|
|
908
|
+
if (this._$htmlText) {
|
|
909
|
+
return this._$htmlText;
|
|
910
|
+
}
|
|
911
|
+
const style = textFormatHtmlTextGenerateStyleService(this.defaultTextFormat);
|
|
912
|
+
this._$htmlText = `<span style="${style}">${this._$text.replace(/\n/g, "<br>")}</span>`;
|
|
913
|
+
return this._$htmlText;
|
|
914
|
+
}
|
|
915
|
+
set htmlText(html_text) {
|
|
916
|
+
if (this._$htmlText === html_text) {
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
this._$htmlText = `${html_text}`;
|
|
920
|
+
this._$rawHtmlText = "";
|
|
921
|
+
this._$text = "";
|
|
922
|
+
this._$isHTML = true;
|
|
923
|
+
textFieldReloadUseCase(this);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* @description テキストフィールド内の文字数です。
|
|
927
|
+
* The int of characters in a text field.
|
|
928
|
+
*
|
|
929
|
+
* @member {number}
|
|
930
|
+
* @readonly
|
|
931
|
+
* @public
|
|
932
|
+
*/
|
|
933
|
+
get length() {
|
|
934
|
+
return this.text.length;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* @description フィールドが複数行テキストフィールドであるかどうかを示します。
|
|
938
|
+
* Indicates whether field is a multiline text field.
|
|
939
|
+
*
|
|
940
|
+
* @member {boolean}
|
|
941
|
+
* @default false
|
|
942
|
+
* @public
|
|
943
|
+
*/
|
|
944
|
+
get multiline() {
|
|
945
|
+
return this._$multiline;
|
|
946
|
+
}
|
|
947
|
+
set multiline(multiline) {
|
|
948
|
+
if (multiline === this._$multiline) {
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
this._$multiline = !!multiline;
|
|
952
|
+
textFieldReloadUseCase(this);
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* @description フィールドが複数行テキストフィールドであるかどうかを示します。
|
|
956
|
+
* Indicates whether field is a multiline text field.
|
|
957
|
+
*
|
|
958
|
+
* @member {number}
|
|
959
|
+
* @readonly
|
|
960
|
+
* @public
|
|
961
|
+
*/
|
|
962
|
+
get numLines() {
|
|
963
|
+
const textData = textFieldGetTextDataUseCase(this);
|
|
964
|
+
return textData.lineTable.length;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* @description テキストフィールドのスクロール垂直位置です。
|
|
968
|
+
* The scroll vertical position of the text field.
|
|
969
|
+
*
|
|
970
|
+
* @member {number}
|
|
971
|
+
* @public
|
|
972
|
+
*/
|
|
973
|
+
get scrollX() {
|
|
974
|
+
return this.$scrollX;
|
|
975
|
+
}
|
|
976
|
+
set scrollX(scroll_x) {
|
|
977
|
+
textFieldSetScrollXUseCase(this, scroll_x);
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* @description テキストフィールドのスクロール垂直位置です。
|
|
981
|
+
* The scroll vertical position of the text field.
|
|
982
|
+
*
|
|
983
|
+
* @member {number}
|
|
984
|
+
* @public
|
|
985
|
+
*/
|
|
986
|
+
get scrollY() {
|
|
987
|
+
return this.$scrollY;
|
|
988
|
+
}
|
|
989
|
+
set scrollY(scroll_y) {
|
|
990
|
+
textFieldSetScrollYUseCase(this, scroll_y);
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* @description テキストフィールド内の現在のテキストであるストリングです。
|
|
994
|
+
* A string that is the current text in the text field.
|
|
995
|
+
*
|
|
996
|
+
* @member {string}
|
|
997
|
+
* @default ""
|
|
998
|
+
* @public
|
|
999
|
+
*/
|
|
1000
|
+
get text() {
|
|
1001
|
+
if (!this._$isHTML) {
|
|
1002
|
+
return this._$text;
|
|
1003
|
+
}
|
|
1004
|
+
if (!this._$rawHtmlText) {
|
|
1005
|
+
this._$rawHtmlText = textFieldHtmlTextToRawTextUseCase(this);
|
|
1006
|
+
}
|
|
1007
|
+
return this._$rawHtmlText;
|
|
1008
|
+
}
|
|
1009
|
+
set text(text) {
|
|
1010
|
+
text = `${text}`;
|
|
1011
|
+
if (text === "") {
|
|
1012
|
+
if (this.scrollX) {
|
|
1013
|
+
this.scrollX = 0;
|
|
1014
|
+
}
|
|
1015
|
+
if (this.scrollY) {
|
|
1016
|
+
this.scrollY = 0;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
if (text === this._$text) {
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
// reset
|
|
1023
|
+
this._$htmlText = "";
|
|
1024
|
+
this._$rawHtmlText = "";
|
|
1025
|
+
this._$isHTML = false;
|
|
1026
|
+
this._$text = text;
|
|
1027
|
+
textFieldReloadUseCase(this);
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* @description テキストの高さです(ピクセル単位)。
|
|
1031
|
+
* The height of the text in pixels.
|
|
1032
|
+
*
|
|
1033
|
+
* @member {number}
|
|
1034
|
+
* @readonly
|
|
1035
|
+
* @public
|
|
1036
|
+
*/
|
|
1037
|
+
get textHeight() {
|
|
1038
|
+
const textData = textFieldGetTextDataUseCase(this);
|
|
1039
|
+
return textData.textHeight;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* @description テキストの幅です(ピクセル単位)。
|
|
1043
|
+
* The width of the text in pixels.
|
|
1044
|
+
*
|
|
1045
|
+
* @member {number}
|
|
1046
|
+
* @readonly
|
|
1047
|
+
* @public
|
|
1048
|
+
*/
|
|
1049
|
+
get textWidth() {
|
|
1050
|
+
const textData = textFieldGetTextDataUseCase(this);
|
|
1051
|
+
return textData.textWidth;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* @description 輪郭のテキスト幅です。0(デフォルト値)で無効にできます。
|
|
1055
|
+
* The text width of the outline, which can be disabled with 0 (the default value).
|
|
1056
|
+
*
|
|
1057
|
+
* @member {number}
|
|
1058
|
+
* @default 0
|
|
1059
|
+
* @public
|
|
1060
|
+
*/
|
|
1061
|
+
get thickness() {
|
|
1062
|
+
return this._$thickness;
|
|
1063
|
+
}
|
|
1064
|
+
set thickness(thickness) {
|
|
1065
|
+
thickness |= 0;
|
|
1066
|
+
if (thickness === this._$thickness) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
this._$thickness = thickness;
|
|
1070
|
+
textFieldApplyChangesService(this);
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* @description 輪郭のテキストの色です(16 進数形式)。
|
|
1074
|
+
* The color of the outline text. (Hexadecimal format)
|
|
1075
|
+
*
|
|
1076
|
+
* @member {number}
|
|
1077
|
+
* @default 0
|
|
1078
|
+
* @public
|
|
1079
|
+
*/
|
|
1080
|
+
get thicknessColor() {
|
|
1081
|
+
return this._$thicknessColor;
|
|
1082
|
+
}
|
|
1083
|
+
set thicknessColor(thickness_color) {
|
|
1084
|
+
thickness_color = $clamp($toColorInt(thickness_color), 0, 0xffffff, 0);
|
|
1085
|
+
if (thickness_color === this._$thicknessColor) {
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
this._$thicknessColor = thickness_color;
|
|
1089
|
+
textFieldApplyChangesService(this);
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* @description テキストフィールドのテキストを折り返すかどうかを示すブール値です。
|
|
1093
|
+
* A Boolean value that indicates whether the text field has word wrap.
|
|
1094
|
+
*
|
|
1095
|
+
* @member {boolean}
|
|
1096
|
+
* @default false
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
get wordWrap() {
|
|
1100
|
+
return this._$wordWrap;
|
|
1101
|
+
}
|
|
1102
|
+
set wordWrap(word_wrap) {
|
|
1103
|
+
if (this._$wordWrap === word_wrap) {
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
this._$wordWrap = !!word_wrap;
|
|
1107
|
+
textFieldReloadUseCase(this);
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* @description 表示オブジェクトの幅を示します(ピクセル単位)。
|
|
1111
|
+
* Indicates the width of the display object, in pixels.
|
|
1112
|
+
*
|
|
1113
|
+
* @member {number}
|
|
1114
|
+
* @public
|
|
1115
|
+
*/
|
|
1116
|
+
get width() {
|
|
1117
|
+
return super.width;
|
|
1118
|
+
}
|
|
1119
|
+
set width(width) {
|
|
1120
|
+
width = +width;
|
|
1121
|
+
if (!isNaN(width) && 0 > width) {
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
const xMax = width + this.bounds.xMin;
|
|
1125
|
+
if (xMax === this.bounds.xMax) {
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
this.bounds.xMax = xMax;
|
|
1129
|
+
textFieldReloadUseCase(this);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* @description 表示オブジェクトの高さを示します(ピクセル単位)。
|
|
1133
|
+
* Indicates the height of the display object, in pixels.
|
|
1134
|
+
*
|
|
1135
|
+
* @member {number}
|
|
1136
|
+
* @public
|
|
1137
|
+
*/
|
|
1138
|
+
get height() {
|
|
1139
|
+
return super.height;
|
|
1140
|
+
}
|
|
1141
|
+
set height(height) {
|
|
1142
|
+
height = +height;
|
|
1143
|
+
if (!isNaN(height) && 0 > height) {
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const yMax = height + this.bounds.yMin;
|
|
1147
|
+
if (yMax === this.bounds.yMax) {
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
this.bounds.yMax = yMax;
|
|
1151
|
+
textFieldReloadUseCase(this);
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* @description newText パラメーターで指定されたストリングを、
|
|
1155
|
+
* テキストフィールドのテキストの最後に付加します。
|
|
1156
|
+
* Appends the string specified by the newText parameter
|
|
1157
|
+
* to the end of the text of the text field.
|
|
1158
|
+
*
|
|
1159
|
+
* @param {string} new_text
|
|
1160
|
+
* @return void
|
|
1161
|
+
* @method
|
|
1162
|
+
* @public
|
|
1163
|
+
*/
|
|
1164
|
+
appendText(new_text) {
|
|
1165
|
+
const currentText = this.text;
|
|
1166
|
+
this.text = currentText + `${new_text}`;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* @description テキストフィールドのフォーカス位置にテキスtを追加します。
|
|
1170
|
+
* Adds text to the focus position of the text field.
|
|
1171
|
+
*
|
|
1172
|
+
* @param {string} new_text
|
|
1173
|
+
* @return {void}
|
|
1174
|
+
* @method
|
|
1175
|
+
* @public
|
|
1176
|
+
*/
|
|
1177
|
+
insertText(new_text) {
|
|
1178
|
+
textFieldInsertTextUseCase(this, new_text);
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* @description テキストフィールドの選択範囲を削除します。
|
|
1182
|
+
* Deletes the selection range of the text field.
|
|
1183
|
+
*
|
|
1184
|
+
* @return {void}
|
|
1185
|
+
* @method
|
|
1186
|
+
* @public
|
|
1187
|
+
*/
|
|
1188
|
+
deleteText() {
|
|
1189
|
+
textFieldDeleteTextUseCase(this);
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* @description lineIndex パラメーターで指定された行のテキストを返します。
|
|
1193
|
+
* Returns the text of the line specified by the lineIndex parameter.
|
|
1194
|
+
*
|
|
1195
|
+
* @param {number} line_index
|
|
1196
|
+
* @return {string}
|
|
1197
|
+
* @public
|
|
1198
|
+
*/
|
|
1199
|
+
getLineText(line_index) {
|
|
1200
|
+
return this._$text || this._$htmlText
|
|
1201
|
+
? textFieldGetLineTextUseCase(this, line_index | 0)
|
|
1202
|
+
: "";
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* @description beginIndex パラメーターと endIndex パラメーターで指定された文字範囲を、
|
|
1206
|
+
* newText パラメーターの内容に置き換えます。
|
|
1207
|
+
* Replaces the range of characters that the beginIndex
|
|
1208
|
+
* and endIndex parameters specify with the contents of the newText parameter.
|
|
1209
|
+
*
|
|
1210
|
+
* @param {string} new_text
|
|
1211
|
+
* @param {number} begin_index
|
|
1212
|
+
* @param {number} end_index
|
|
1213
|
+
* @return {void}
|
|
1214
|
+
* @method
|
|
1215
|
+
* @public
|
|
1216
|
+
*/
|
|
1217
|
+
replaceText(new_text, begin_index, end_index) {
|
|
1218
|
+
textFieldReplaceTextUseCase(this, new_text, begin_index | 0, end_index | 0);
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* @return {void}
|
|
1222
|
+
* @method
|
|
1223
|
+
* @public
|
|
1224
|
+
*/
|
|
1225
|
+
selectAll() {
|
|
1226
|
+
textFieldSelectAllUseCase(this);
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* @description テキストフィールドの選択範囲をコピーします。
|
|
1230
|
+
* Copy a selection of text fields.
|
|
1231
|
+
*
|
|
1232
|
+
* @return {void}
|
|
1233
|
+
* @method
|
|
1234
|
+
* @public
|
|
1235
|
+
*/
|
|
1236
|
+
copy() {
|
|
1237
|
+
textFieldCopyUseCase(this);
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* @description コピーしたテキストを選択範囲に貼り付けます。
|
|
1241
|
+
* Paste the copied text into the selected range.
|
|
1242
|
+
*
|
|
1243
|
+
* @return {void}
|
|
1244
|
+
* @method
|
|
1245
|
+
* @public
|
|
1246
|
+
*/
|
|
1247
|
+
paste() {
|
|
1248
|
+
textFieldPasteService(this);
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* @description テキストフィールドのフォーカス位置を設定します。
|
|
1252
|
+
* Sets the focus position of the text field.
|
|
1253
|
+
*
|
|
1254
|
+
* @param {number} stage_x
|
|
1255
|
+
* @param {number} stage_y
|
|
1256
|
+
* @param {boolean} [selected=false]
|
|
1257
|
+
* @return {void}
|
|
1258
|
+
* @method
|
|
1259
|
+
* @public
|
|
1260
|
+
*/
|
|
1261
|
+
setFocusIndex(stage_x, stage_y, selected = false) {
|
|
1262
|
+
textFieldSetFocusIndexUseCase(this, stage_x, stage_y, selected);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* @description キーダウンイベントを処理します。
|
|
1266
|
+
* Processes the key down event.
|
|
1267
|
+
*
|
|
1268
|
+
* @param {KeyboardEvent} event
|
|
1269
|
+
* @return {void}
|
|
1270
|
+
* @method
|
|
1271
|
+
* @public
|
|
1272
|
+
*/
|
|
1273
|
+
keyDown(event) {
|
|
1274
|
+
textFieldKeyDownEventUseCase(this, event);
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* @description character 情報を元に DisplayObject を構築
|
|
1278
|
+
* Build DisplayObject based on character
|
|
1279
|
+
*
|
|
1280
|
+
* @param {ICharacter} character
|
|
1281
|
+
* @param {LoaderInfo} [loader_info=null]
|
|
1282
|
+
* @return {void}
|
|
1283
|
+
* @method
|
|
1284
|
+
* @protected
|
|
1285
|
+
*/
|
|
1286
|
+
$sync(character, loader_info = null) {
|
|
1287
|
+
if (loader_info) {
|
|
1288
|
+
super.$syncLoaderInfo(loader_info);
|
|
1289
|
+
}
|
|
1290
|
+
textFieldBuildFromCharacterUseCase(this, character);
|
|
1291
|
+
}
|
|
1292
|
+
}
|