Picture:onHover(x, y, buttons)event
This event is fired when the user moves the mouse pointer over the Picture.
Parameters
x
The horizontal position of the mouse in the Picture area (zero means the left border of the widget).
y
The vertical position of the mouse in the Picture area (zero means the top border of the widget).
buttons
A table which fields indicates if mouse buttons or special keys have been pressed during the move :
"left":trueif left mouse button is pressed,falseotherwise"right":trueif right mouse button is pressed,falseotherwise"middle":trueif middle mouse button is pressed,falseotherwise"control":trueif the CONTROL key is pressed,falseotherwise"shift":trueif the SHIFT mouse button is pressed,falseotherwise
Return value
The event returns no value.Example
--! luart-extensions
import ui
-- create a simple window
local win = ui.Window("Picture:onHover() sample", 340, 200)
local picture = ui.Picture(win, "LuaRT.png", -74)
local factor = 1
local delta = 0
function picture:onHover()
delta = -0.01
factor = factor - 0.01
end
function picture:onLeave()
delta = 0.01
factor = factor + 0.01
end
win:show()
repeat
ui.update()
if factor > 0 and factor < 1 then
factor = factor + delta
picture:resize(factor)
picture:center()
end
until win.visible == false