Lists are a thing now
Looks like child bounds arent clipped properly though, ugh
This commit is contained in:
@@ -102,10 +102,10 @@ func (entity *entity) scrollTargetChildAt (point image.Point) *entity {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (entity *entity) forMouseTargetContainers (callback func (tomo.MouseTargetContainer)) {
|
||||
func (entity *entity) forMouseTargetContainers (callback func (tomo.MouseTargetContainer, tomo.Element)) {
|
||||
if entity.parent == nil { return }
|
||||
if parent, ok := entity.parent.element.(tomo.MouseTargetContainer); ok {
|
||||
callback(parent)
|
||||
callback(parent, entity.element)
|
||||
}
|
||||
entity.parent.forMouseTargetContainers(callback)
|
||||
}
|
||||
@@ -211,7 +211,8 @@ func (entity *entity) PlaceChild (index int, bounds image.Rectangle) {
|
||||
|
||||
func (entity *entity) SelectChild (index int, selected bool) {
|
||||
child := entity.children[index]
|
||||
if element, ok := entity.element.(tomo.Selectable); ok {
|
||||
if element, ok := child.element.(tomo.Selectable); ok {
|
||||
if child.selected == selected { return }
|
||||
child.selected = selected
|
||||
element.HandleSelectionChange()
|
||||
}
|
||||
|
||||
@@ -212,11 +212,11 @@ func (window *window) handleButtonPress (
|
||||
point.X, point.Y,
|
||||
input.Button(buttonEvent.Detail))
|
||||
}
|
||||
callback := func (container tomo.MouseTargetContainer) {
|
||||
callback := func (container tomo.MouseTargetContainer, child tomo.Element) {
|
||||
container.HandleChildMouseDown (
|
||||
point.X, point.Y,
|
||||
input.Button(buttonEvent.Detail),
|
||||
underneath.element)
|
||||
child)
|
||||
}
|
||||
underneath.forMouseTargetContainers(callback)
|
||||
}
|
||||
@@ -238,12 +238,12 @@ func (window *window) handleButtonRelease (
|
||||
int(buttonEvent.EventY),
|
||||
input.Button(buttonEvent.Detail))
|
||||
}
|
||||
callback := func (container tomo.MouseTargetContainer) {
|
||||
callback := func (container tomo.MouseTargetContainer, child tomo.Element) {
|
||||
container.HandleChildMouseUp (
|
||||
int(buttonEvent.EventX),
|
||||
int(buttonEvent.EventY),
|
||||
input.Button(buttonEvent.Detail),
|
||||
dragging.element)
|
||||
child)
|
||||
}
|
||||
dragging.forMouseTargetContainers(callback)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user