2 Commits

Author SHA1 Message Date
c409bc1a1e Don't crash when user hovers over nothing 2024-05-07 20:14:46 -04:00
6a2dc36140 Fix ContainerBox child insertion 2024-05-07 20:11:58 -04:00
2 changed files with 13 additions and 7 deletions

View File

@@ -119,10 +119,14 @@ func (this *containerBox) Insert (child, before tomo.Object) {
beforeBox := assertAnyBox(before.GetBox())
index := indexOf(this.children, tomo.Box(beforeBox))
if index < 0 { return }
if index < 0 {
this.children = append(this.children, tomo.Box(box))
} else {
this.children = insert(this.children, index, tomo.Box(box))
}
box.setParent(this)
this.children = insert(this.children, index, tomo.Box(box))
this.invalidateLayout()
this.invalidateMinimum()
}

View File

@@ -339,11 +339,13 @@ func (window *window) handleMotionNotify (
}
underneath := window.boxUnder(image.Pt(x, y), eventCategoryMouse)
window.hover(underneath)
if !handled {
underneath.handleMouseMove()
if underneath != nil {
window.hover(underneath)
if !handled {
underneath.handleMouseMove()
}
}
}
func (window *window) compressExpose (