-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add improved FlxInputText to core Flixel #3219
Conversation
- Regenerate text graphic when `passwordMode` changes
- Add `setSelection()` function - `FlxInputText` variables are now destroyed properly
- Added `scrollH`, `scrollV`, `bottomScrollV`, `maxScrollH` & `maxScrollV` variables - Return end of text if character isn't found at position
- Selection boxes are now clipped inside the text bounds - Simplified getting the Y offset of a line
- Fix scrollV not being able to be modified directly
- 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)
- 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)
- Moved action callback types to an enum abstract
- Added `focusGained` and `focusLost` callbacks - Fixed selection boxes not being clipped properly when they're compeletely out of bounds
- 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 change and scroll action callbacks - Made `replaceSelectedText()` public
- Fixed space not being inputted on HTML5
- 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
… now) - Fixed untypeable characters being added to text input on 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)
- 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
- 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`
- Remove setting `_autoHeight` to false after setting multiline to true as its no longer needed
- Remove unneeded `selectable` comment
…IGHT` - 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`
- 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
You mean for the FlxInputTextManager? |
yes |
- Add `unregisterAll()` to FlxInputTextManager
@Starmapo iirc your text library is used in |
Yes, I already have the necessary modifications on my local repository, once 5.9.0 is released I will open the PR for haxeui-flixel. |
Some changes:
I need to test this on my windows machine, too |
I'm seeing more heavy overuse of setters for handling huge portions of code, in my experience this is a recipe for fragile code, especially when different setters set each other recursively. I see more instances of unneeded complexity that I'd like to deal with now |
I realize that many of these things are copied from the old FlxInputText, and don't need to be corrected now |
Sorry this took so long, I think I was a little nervous since it's fuckin huge, also dealing with some family stuff atm Thanks a ton! |
Don't worry about it, I wasn't in a rush or anything, and I agree its pretty huge. Thank you for accepting it ^^ |
This is the completed version of #3191 that adds an improved version of FlxInputText from flixel-ui to the base library.
Improvements over the original FlxInputText
selectionBeginIndex
andselectionEndIndex
variables added so you can get the span of the current selection.selectionColor
andselectedTextColor
variables can be changed to set the selection background and the selected text's color respectively. The custom format for the selected text can be disabled withuseSelectedTextFormat
.setSelection()
and replace the currently selected text withreplaceSelectedText()
.multiline
variable to dictate whether new lines can be created by the user.scrollH
andscrollV
variables.bottomScrollV
,maxScrollH
andmaxScrollV
have also been added as helper read-only variables.mouseWheelEnabled
dictates whether or not the text field can be scrolled with the mouse wheel, by default set to true.background
variable can now be changed to toggle the background on/off.selectable
andeditable
variables to dictate whether the text field can be selected/edited.forceCase
,filterMode
and the callback's action types.InputTextFrontEnd
added (accessible viaFlxG.inputText
) to allow for easier implementations of other types of input texts.Things to consider
lines
. From what I could see, this didn't actually dictate the amount of lines that could be added, and was basically just a setter for if the text was multiline or not (which on top of that, multiline wasn't properly implemented in the original input text).