Propagate mouse motion events to boxes

This commit is contained in:
Sasha Koshka 2024-07-27 15:13:49 -04:00
parent d944f6016f
commit 0be41779d4

View File

@ -115,17 +115,18 @@ func (this *Hierarchy) HandleMouseMove (position image.Point) {
for _, dragSet := range this.drags { for _, dragSet := range this.drags {
for _, box := range dragSet { for _, box := range dragSet {
if box.handleMouseMove() { break } if box.handleMouseMove() { break }
}
dragged = true dragged = true
} }
}
if dragged { return } if dragged { return }
// TODO we can hover over multiple boxes at once. however, any way of // TODO we can hover over multiple boxes at once. however, any way of
// detecting this involves several slice allocations every time we // detecting this involves several slice allocations every time we
// process a MouseMove event. perhaps we just ought to suck it up and do // process a MouseMove event. perhaps we just ought to suck it up and do
// it. // it. or perhaps doing *this* is the better way? we may never know.
box := this.boxUnder(position) box := this.boxUnder(position)
if box != nil { if box != nil {
box := this.considerMaskingParents(box)
this.hover(box) this.hover(box)
box.handleMouseMove() box.handleMouseMove()
} }