mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2026-04-22 15:57:15 +08:00
exp/textinput: add Field.SetBounds and Field.Handled, process input via internal hook
Replace the per-frame HandleInputWithBounds call with SetBounds (call only when bounds change) and Handled (query whether input was consumed). Input processing now runs automatically via an internal hook on before-update, so users no longer need to drive it every tick. Deprecate HandleInput and HandleInputWithBounds in favor of the new API. Closes #3420 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -139,11 +139,8 @@ func (t *TextField) Update() error {
|
||||
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))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if handled {
|
||||
t.field.SetBounds(image.Rect(x0, y0, x1, y1))
|
||||
if t.field.Handled() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user