mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-09-26 20:11:28 +08:00
exp/textinput: clarify the bounds for HandleInputWithBounds
This commit is contained in:
@@ -136,7 +136,7 @@ func (t *TextField) Update() error {
|
||||
cx, cy := t.cursorPos()
|
||||
px, py := textFieldPadding()
|
||||
x0 := x + cx + px
|
||||
x1 := x + cx + px + 6 // To be exact, this should be the width of the current character.
|
||||
x1 := x0 + 1
|
||||
y0 := y + cy + py
|
||||
y1 := y0 + int(fontFace.Metrics().HLineGap+fontFace.Metrics().HAscent+fontFace.Metrics().HDescent)
|
||||
handled, err := t.field.HandleInputWithBounds(image.Rect(x0, y0, x1, y1))
|
||||
|
@@ -109,6 +109,8 @@ func (f *Field) HandleInput(x, y int) (handled bool, err error) {
|
||||
// HandleInputWithBounds updates the field state.
|
||||
// HandleInputWithBounds must be called every tick, i.e., every Update, when Field is focused.
|
||||
// HandleInputWithBounds takes a character bounds, which decides the position where an IME window is shown if needed.
|
||||
// The bounds width doesn't matter very much as long as it is greater than 0.
|
||||
// The bounds height should be the text height like a cursor height.
|
||||
//
|
||||
// HandleInputWithBounds returns whether the text inputting is handled or not.
|
||||
// If HandleInputWithBounds returns true, a Field user should not handle further input events.
|
||||
|
Reference in New Issue
Block a user