local Vec3 = require "lib.utils.vec3"

--- @class PanningState
--- @field pos Vec3 | nil
--- @field delta Vec3
local panning = {
    pos = nil,
    delta = Vec3 {},
}

function panning:update(dt)
    if love.mouse.isDown(3) then
        local mouseX, mouseY = love.mouse.getPosition()
        if (panning.pos) then panning.delta = panning.pos - Vec3 { mouseX, mouseY } end
        panning.pos = Vec3 { mouseX, mouseY }
        return
    end
    panning.pos = nil
    panning.delta = Vec3 {}
end

return panning
