-
Notifications
You must be signed in to change notification settings - Fork 220
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
Added basic cursor to TextInput #150
base: master
Are you sure you want to change the base?
Conversation
Screen doesn't redraw on :hover, but selection works properly
Fixed calculator example, implemented proper business logic
Implement background-size:contain and background-size:cover
…peat This was implemented by using LayoutPrimitiveInfo's clip_rect functionality. If `no-repeat` is specified in CSS, the rect is clipped to the size of the image on both axis. If `repeat-x` is specified, the rect's height is clipped to the image height. If `repeat-y` is specified, the rect's width is clipped to the image width.`
Implement background-repeat: no-repeat | repeat | repeat-x | repeat-y
Previously, ":nth-child(1)" did not parse correctly because the tokenizer was broken to not include the "1" in the actual parser. This update also adds support (in the tokenizer, not the parser) for ::selectors, @ rules in CSS and free-standing string literals (necessary for @ keyframes and @ media).
Necessary for handling focusing callbacks on text fields and other, menu-related things.
Use correct resource paths for text shaping example
Thanks for reworking it, this looks a lot better than the previous attempt, good job. I'll take a look later for minor changes, but overall it looks decent. The "one frame delay" problem - yeah, it's a problem and I'm not sure how to solve it (maybe using inline layout later on instead of absolute / relative positioning, so that the position of the cursor is treated like a "span" element), but it's certainly better than nothing. I wouldn't necessarily put the But for a first attempt it's not too bad. |
Thanks, I'll go look at the CallbackInfo and find a logical place to add the LayoutResult to it. Edit: a logical place in the code to snag the LayoutResult, I mean. |
I moved the LayoutResult to UiState so that it gets passed to callbacks in CallbackInfo. Since the render happens after the callbacks, I had to put it on some existing struct so that it would be available in the next pass. |
d688cd8
to
acaffe6
Compare
28f9fba
to
76f4787
Compare
8105db1
to
8d67426
Compare
2688fd0
to
4ded261
Compare
I removed a lot of the cruft from the previous iteration of the cursor and tried to limit the changes a little bit. The LayoutResult is being moved into the WindowState and exposed to callbacks. This happens at the bottom of update_display_list, right before it would have gone out of scope- keeping it around shouldn't change performance too much.
Issues:
Cursor height isn't currently set. It's always the same height as the input widget, because I would prefer to set it programmatically but allow users to override it in CSS, and that isn't possible right now as far as I know.
Cursor is a little bit off when text overflows due to Overflowing text in input field is displayed higher than non-overflowing. #142.
The cursor doesn't blink. With CSS this would have required animation/keyframes, and doing it programmatically would have been involved and hacky.
The cursor is always one-character delayed from the real position. This is because:
So when the text is displayed, the cursor is always positioned as it would have been in the last render. This is an issue that I'm not sure how to fix. My last attempt at this was re-calculating text width in the TextInputState in order to position the cursor for the next render, but it would be better not to re-do the text layout again if we don't have to.