Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial text input implementation * Fix code climate? * Add missing FLX_MOUSE check * Add multiline variable - Regenerate text graphic when `passwordMode` changes * Place caret at closest character to mouse * Selection boxes + selected text color - Add `setSelection()` function - `FlxInputText` variables are now destroyed properly * Implement text selection with mouse & text scrolling - Added `scrollH`, `scrollV`, `bottomScrollV`, `maxScrollH` & `maxScrollV` variables - Return end of text if character isn't found at position * Fix selection not working correctly when mouse is out of bounds - Selection boxes are now clipped inside the text bounds - Simplified getting the Y offset of a line * Mouse wheel scrolling - Fix scrollV not being able to be modified directly * Implemented double press and dragging - Selection sprites now just change their color instead of making new graphics - scrollH can now be modified properly as well - Word wrap no longer changes with multiline (multiline only affects adding new lines) * Action callbacks * Fix "final" keyword screwing up code climate * Various fixes & improvements - Caret is now positioned properly with different alignments - Caret is now clipped inside the text bounds - Caret is now automatically resized when changing `bold`, `font`, `italic`, `size` or `systemFont` variables - Fixed crash when pressing down a key while there isn't a focused input text - Fixed selected text format overwriting the border color - Fixed caret not being visible when text is empty - Fixed selection boxes sometimes not being updated immediately - Added `useSelectedTextFormat` variable - Double press check is now when the mouse is released (same as OpenFL) * Add `forceCase` and filterMode` - Moved action callback types to an enum abstract * Added background for text input - Added `focusGained` and `focusLost` callbacks - Fixed selection boxes not being clipped properly when they're compeletely out of bounds * Some improvements - Added bounds check while changing `caretIndex`, `caretWidth`, `fieldBorderThickness` and `maxLength` - FlxInputText is now single-line by default - Fixed text scroll being reset while moving selection with mouse - Caret index now starts at the end of the text if focus is enabled through code - Background now gets regenerated in `regenGraphic` instead of instantly after changing a related variable * Added `editable` and selectable` variables - Added change and scroll action callbacks - Made `replaceSelectedText()` public * Flixel hotkeys (volume & debugger) are now disabled while inputting text - Fixed space not being inputted on HTML5 * Caret flashing timer - Fixed text going out of bounds when enabling multiline without a field height set - Last click time for double click now resets if the mouse clicked on something else * Optimized selection box sprites (only visible lines are accounted for now) - Fixed untypeable characters being added to text input on Flash * Various fixes for Flash - Fixed text selection and caret positioning on Flash - Copy, cut, paste and select all commands now work on Flash - Fixed horizontal scroll not being set automatically on Flash - Moved to using Flash's `TextEvent.TEXT_INPUT` event (does not dispatch with invalid characters) * Fixed text selection and scrolling on other platforms * Fixed text selection with word wrapping enabled * Added touch support - Now uses `window.setTextInputRect()` to prevent keyboard overlay from blocking the text field - Fixed pointer position being inaccurate with camera scrolling - Fixed `getCharBoundaries()` not giving the correct Y position * Added documentation - Fixed not being able to add text if the field starts out empty - Fixed the caret being the wrong size if the text field is empty - Fixed the background not being resized when auto size is enabled - Changing `customFilterPattern` now automatically sets `filterMode` to `CUSTOM_FILTER` - Renamed `_lastClickTime` to `_lastPressTime` * Add documentation to `multiline` variable - Remove setting `_autoHeight` to false after setting multiline to true as its no longer needed * Add `mouseWheelEnabled` variable - Remove unneeded `selectable` comment * Replaced `PREVIOUS_LINE` and `NEXT_LINE` with `WORD_LEFT` and `WORD_RIGHT` - Ctrl + Up/Down now dispatches `LINE_LEFT` or `LINE_RIGHT` instead of `HOME` or `END` - Renamed `LINE_BEGINNING` and `LINE_END` to `LINE_LEFT` and `LINE_RIGHT` * Various fixes - Clip rect should now work properly - Fixed caret showing up after changing `text` through code - Focus will not be removed due to clicking outside of the text field if it has been granted via code in the same frame - Caret will no longer be visible if the text field isn't editable - Fixed some html5 tests not compiling on CI * Various more fixes - Fixed crash from recursive calls to `regenBackground()` due to `clipSprite()` - Fixed crash from `pointer.getWorldPosition()` - Fixed background not being updated after changing text format - Moved caret sprite regeneration to `regenGraphic()` * Move input text "frontend" to a manager plugin * Fixed missing rename * Replace `callback` with `onTextChange` and `onScrollChange` signals - Replace `focusGained` and `focusLost` with `onFocusChange` signal - Renamed filter mode options and added `CHARS` option - Removed `customFilterPattern` as its now defined in the enum itself * Move `ENTER_ACTION` over to `onEnter` * Implement `destroy()` for FlxInputTextManager - Add `unregisterAll()` to FlxInputTextManager * add onTypingAction * allow custom manager * add setManager * remove focus setter for setFocus * better destroy/init * use case ifs * improve mac key behavior * fix selection start/end issue * remove set_hasFocus for startFocus and endFocus * use final signals * let openfl handle maxChars * inline setters remove redundancies * simplify caret blink --------- Co-authored-by: George FunBook <[email protected]>
- Loading branch information