Skip to content
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

Fixes for the TextInput component #21

Merged
merged 4 commits into from
Oct 7, 2018
Merged

Fixes for the TextInput component #21

merged 4 commits into from
Oct 7, 2018

Conversation

Yatekii
Copy link
Contributor

@Yatekii Yatekii commented Oct 7, 2018

I wasn't able to fix the vertical layout yet. Something with the height estimator is very off. I guess we need to discuss some more before I can fix it. Also there is too much mixing between PT and PX I feel :)

Noah Huesser added 2 commits October 6, 2018 17:53
+ Made the TextInput such that not all currently pressed keys will be input to the string but only the last one pressed.
… a On::MouseMoved is issued over the TextInput but rather when an On::KeyDown is issued.
@coveralls
Copy link

coveralls commented Oct 7, 2018

Pull Request Test Coverage Report for Build 442

  • 0 of 3 (0.0%) changed or added relevant lines in 1 file are covered.
  • 12 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-2.0e**-05%**) to 0.048%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/text_layout.rs 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
src/window_state.rs 1 0.0%
src/text_layout.rs 11 0.0%
Totals Coverage Status
Change from base Build 425: -2.0e-05%
Covered Lines: 1
Relevant Lines: 2066

💛 - Coveralls

@fschutt
Copy link
Owner

fschutt commented Oct 7, 2018

Three small things:

  • I would use an Option<VirtualKeyCode> - what if someone presses a non-character key. Sure, for the text component only the char is important, but maybe for other components it's better to match the virtual key, maybe components want to react to non-character keys, too. For example, the text input should later ignore return keys (as it's just one line of text) - it's easier to match on VirtualKeyCode::Return rather than \n.
  • I would write it as:
if let Some(key) = keyboard_state.latest_key.and_then(virtual_key_code_to_char) {
    data.text.push(if keyboard_state.shift_down { key.to_uppercase().next().unwrap() } else { key });
}

Noah Huesser added 2 commits October 7, 2018 14:10
+ The issue is still not fully fixed yet. It works for a number of lines < 5. After it starts to fault.
+ Possibly an issue with the text height estimator.
@fschutt fschutt merged commit 4355366 into fschutt:master Oct 7, 2018
fschutt pushed a commit that referenced this pull request May 13, 2019
fschutt added a commit that referenced this pull request May 13, 2019
Fixes for the TextInput component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants