WIP scrolling
This commit is contained in:
7
input.go
7
input.go
@@ -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))))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user