feat(ags cursorbox): allow passing extra onHover stuff to it

This commit is contained in:
matt1432 2023-11-08 11:41:07 -05:00
parent 1fedeb186b
commit 898060e0f3

View file

@ -7,6 +7,8 @@ const display = Gdk.Display.get_default();
export default ({ export default ({
isButton = false, isButton = false,
reset = true, reset = true,
onHover = () => {},
onHoverLost = () => {},
...props ...props
}) => { }) => {
if (!isButton) { if (!isButton) {
@ -18,10 +20,14 @@ export default ({
else else
self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer')); self.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer'));
onHover(self);
}, },
onHoverLost: self => { onHoverLost: self => {
if (reset) if (reset)
self.window.set_cursor(null); self.window.set_cursor(null);
onHoverLost(self);
}, },
}); });
} }