WIP scrolling

This commit is contained in:
2023-09-14 14:48:08 -04:00
parent 312ee6270c
commit c210c07b74
6 changed files with 256 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package objects
import "image"
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/text"
import "git.tebibyte.media/tomo/tomo/theme"
@@ -22,7 +23,9 @@ func NewTextInput (text string) *TextInput {
this.SetText(text)
this.SetFocusable(true)
this.SetSelectable(true)
this.SetOverflow(true, false)
this.OnKeyDown(this.handleKeyDown)
this.OnScroll(this.handleScroll)
return this
}
@@ -88,3 +91,7 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
this.Select(dot)
if changed { this.SetText(string(this.text)) }
}
func (this *TextInput) handleScroll (x, y float64) {
this.ScrollTo(this.ContentBounds().Min.Add(image.Pt(int(x), int(y))))
}