event.scrollY

类型 数字
事件 鼠标
修订 2024.3703 版
关键字 鼠标,scrollY

概述

鼠标滚轮当前的y 滚动值。此值取决于用户的鼠标设置。

示例

-- Called when a mouse event has been received.
local function onMouseEvent( event )
    if event.type == "scroll" then
        if event.scrollY < 0 then
            print( "Mouse is scrolling up with a value of " .. event.scrollY .. "." )
        elseif event.scrollY > 0 then
            print( "Mouse is scrolling down with a value of " .. event.scrollY .. "." )
        end
    end
end

-- Add the mouse event listener.
Runtime:addEventListener( "mouse", onMouseEvent )