Pass mouse input to Text and Input widgets
This commit is contained in:
parent
96b3a2a50f
commit
80d56f9c28
4 changed files with 7 additions and 7 deletions
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module code.rocket9labs.com/tslocum/etk
|
|||
go 1.18
|
||||
|
||||
require (
|
||||
code.rocketnine.space/tslocum/messeji v1.0.4
|
||||
code.rocketnine.space/tslocum/messeji v1.0.5-0.20231027235104-784342f8110a
|
||||
github.com/hajimehoshi/ebiten/v2 v2.6.2
|
||||
golang.org/x/image v0.13.0
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,5 @@
|
|||
code.rocketnine.space/tslocum/messeji v1.0.4 h1:8hDIu1iFXDPc/l84rU0lQIxTT13uSRSQbTWYIdTqlXQ=
|
||||
code.rocketnine.space/tslocum/messeji v1.0.4/go.mod h1:xszLyTZtpyjCVaGmznizLSAlnvraPOSoanlzUBeqGco=
|
||||
code.rocketnine.space/tslocum/messeji v1.0.5-0.20231027235104-784342f8110a h1:s3mTWILsEJxS69ETQWDj+aaajCLt/KDZ0iqJPGRW7kY=
|
||||
code.rocketnine.space/tslocum/messeji v1.0.5-0.20231027235104-784342f8110a/go.mod h1:xszLyTZtpyjCVaGmznizLSAlnvraPOSoanlzUBeqGco=
|
||||
github.com/ebitengine/purego v0.5.0 h1:JrMGKfRIAM4/QVKaesIIT7m/UVjTj5GYhRSQYwfVdpo=
|
||||
github.com/ebitengine/purego v0.5.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||
github.com/hajimehoshi/bitmapfont/v3 v3.0.0 h1:r2+6gYK38nfztS/et50gHAswb9hXgxXECYgE8Nczmi4=
|
||||
|
|
2
input.go
2
input.go
|
@ -74,7 +74,7 @@ func (i *Input) Focused() bool {
|
|||
}
|
||||
|
||||
func (i *Input) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error) {
|
||||
return true, nil
|
||||
return true, i.Field.Update()
|
||||
}
|
||||
|
||||
func (i *Input) HandleKeyboard() (handled bool, err error) {
|
||||
|
|
6
text.go
6
text.go
|
@ -79,15 +79,15 @@ func (t *Text) Text() string {
|
|||
}
|
||||
|
||||
func (t *Text) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error) {
|
||||
return false, nil
|
||||
return t.TextField.HandleMouseEvent(cursor, pressed, clicked)
|
||||
}
|
||||
|
||||
func (t *Text) HandleKeyboard() (handled bool, err error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (f *Text) HandleKeyboardEvent(key ebiten.Key, r rune) (handled bool, err error) {
|
||||
return false, nil
|
||||
func (t *Text) HandleKeyboardEvent(key ebiten.Key, r rune) (handled bool, err error) {
|
||||
return t.TextField.HandleKeyboardEvent(key, r)
|
||||
}
|
||||
|
||||
func (t *Text) Draw(screen *ebiten.Image) error {
|
||||
|
|
Loading…
Reference in a new issue