Code Monkey home page Code Monkey logo

bevy_simple_text_input's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bevy_simple_text_input's Issues

wasm: backspace and enter don't work

winit doesn't send ReceivedCharacter events for these on the web.

So we need to use KeyboardInput events for these. This is unfortunate because the separate event streams can cause timing issues. In another project, to fix these timing issues, I resorted to using KeyboardInput for everything, but this came at the expense of easy international keyboard support.

So I think switching backspace and enter to KeyboardInput is the right call for now, potentially only for wasm if that doesn't complicate things too much.

This is fixed in winit 0.29 (and hopefully bevy 0.12. see bevyengine/bevy#8745) where these two events are unified into KeyEvent.

Add an example for getting and setting the text value

I am thinking along the lines of a simple "spinner."

┌───┐ ┌───────────────┐ ┌───┐
│ - │ │ 12|           │ │ + │
└───┘ └───────────────┘ └───┘

This doesn't need to be full-featured. Just enough for the plus/minus buttons to retrieve the current value and increment it. It's a bit silly to store the value as a text field on the text input, but I like the simplicity for an example.

I am open to other ideas.

Undertanding implementation of `TextInput`

I don't undertsand very well why it is needed to spawn a NodeBundle together with the TextInput if all the input system is embedded in a overflow container and is added as a child to the TextInput entity. The TextInput solely should render with no problem. However, that panics.

Panic on non-ASCII characters

This widget panics if you try to type in any non-ASCII character. For example, if I press option+d on my Mac keyboard it produces "∂" and the app immediately crashes. It seems to be because the library is assuming that all characters are one byte wide.

Get current text without pressing enter

Sometimes it's needed to get current text without pressing enter. It would be convenient to have a component with current text that gets updated.
I know it's possible to get current text from children TextBundle, but it's not quite convenient.

Cursor timer should reset on input

It's distracting for the cursor to blink while typing, and confusing for it to blink while the cursor is moving left/right.

This is a "nice to have" feature and its implementation shouldn't conflict with this project's goals:

The code should be simple enough for users to quickly understand and modify for their own purposes.

If this can't be done very cleanly it's okay not to do it.

TextStyle isn't updated when changed

If TextInput.text_style is changed, we should update the text sections in Text. This is slightly annoying for end-users to do, because you have to take care to not overwrite the font of the cursor.

This is a "nice to have" feature and its implementation shouldn't conflict with this project's goals:

The code should be simple enough for users to quickly understand and modify for their own purposes.

If this can't be done very cleanly it's okay not to do it.

Cursor should not blink when text input is inactive

And it should be set to hidden immediately upon becoming inactive

This is a "nice to have" feature and its implementation shouldn't conflict with this project's goals:

The code should be simple enough for users to quickly understand and modify for their own purposes.

If this can't be done very cleanly it's okay not to do it.

Inner text node position should follow cursor position

To reproduce:

  • cargo run --example basic
  • Type hello there
  • Press left-arrow repeatedly until the cursor disappears

This reveals another issue with the janky zero-width cursor setup when left-arrow is pressed for the first time.

Roughly, we need to

  • Get the relative cursor position from TextLayoutInfo
  • Offset the inner text node so that the cursor is always visible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.