Overhauled mouse events

Everything gets an image.Point instead of an x y pair, and most
things now get modifiers.
This commit is contained in:
Sasha Koshka
2023-04-20 14:44:54 -04:00
parent eaee284aaf
commit 53f78cb0e7
12 changed files with 183 additions and 69 deletions

View File

@@ -87,7 +87,12 @@ func (element *List) Layout () {
}
}
func (element *List) HandleChildMouseDown (x, y int, button input.Button, child tomo.Element) {
func (element *List) HandleChildMouseDown (
position image.Point,
button input.Button,
modifiers input.Modifiers,
child tomo.Element,
) {
if child, ok := child.(tomo.Selectable); ok {
index := element.entity.IndexOf(child)
if element.selected == index { return }
@@ -99,7 +104,12 @@ func (element *List) HandleChildMouseDown (x, y int, button input.Button, child
}
}
func (element *List) HandleChildMouseUp (int, int, input.Button, tomo.Element) { }
func (element *List) HandleChildMouseUp (
position image.Point,
button input.Button,
modifiers input.Modifiers,
child tomo.Element,
) { }
func (element *List) HandleChildFlexibleHeightChange (child tomo.Flexible) {
element.updateMinimumSize()