fix isHovered bounds calculation
This should fix #372. Is isHovered() even necessary?
isHovered() is a fix for nested eventboxes, see this example
const { Window, Box, EventBox, Label } = Widget
const hovered1 = "background-color: red"
const hovered2 = "background-color: blue"
const nonhovered = "background-color: transparent"
const _with = Box({
css: "margin: 10px;",
child: EventBox({
on_hover: self => self.css = hovered1,
on_hover_lost: self => self.css = nonhovered,
child: Box({
css: "padding: 20px;",
child: EventBox({
on_hover: self => self.css = hovered2,
on_hover_lost: self => self.css = nonhovered,
child: Box({
css: "padding: 20px;",
child: Label("with")
})
})
})
})
})
const _without = Box({
css: "margin: 10px;",
child: EventBox({
setup: self => self
.on('leave-notify-event', () => self.css = hovered1)
.on('enter-notify-event', () => self.css = nonhovered),
child: Box({
css: "padding: 20px;",
child: EventBox({
setup: self => self
.on('leave-notify-event', () => self.css = hovered2)
.on('enter-notify-event', () => self.css = nonhovered),
child: Box({
css: "padding: 20px;",
child: Label("without")
})
})
})
})
})
Window({
child: Box([_with, _without])
})
and this PR breaks this fix
Ahh, I get what you're going after. BTW, for _without, the leave => hovered[12] and enter => nonhovered seemed flipped. For _without, you're expecting the onHover and onHoverLost to passthrough from the top-most box to the bottom one. However, Gtk carves out the intersection area, so only the topmost box's hover is respected.
I haven't had a chance to rework your example, but would it be more reasonable to use an Overlay instead? I don't know the equivalent of "zIndex" is in GTK, but I would hope that it works for your use case. Then, AGS wouldn't have to overlay "is my pointer in the region of interest" logic for hover purposes when I'd expect GTK to handle for you.
its fixed in v2!