2023-12-26 14:48:33 +03:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M:peek()
|
|
|
|
local _, bound = ya.preview_code(self)
|
|
|
|
if bound then
|
2024-03-01 05:22:12 +03:00
|
|
|
ya.manager_emit("peek", { bound, only_if = tostring(self.file.url), upper_bound = true })
|
2023-12-26 14:48:33 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function M:seek(units)
|
|
|
|
local h = cx.active.current.hovered
|
|
|
|
if h and h.url == self.file.url then
|
|
|
|
local step = math.floor(units * self.area.h / 10)
|
|
|
|
ya.manager_emit("peek", {
|
2024-03-01 05:22:12 +03:00
|
|
|
math.max(0, cx.active.preview.skip + step),
|
2023-12-26 14:48:33 +03:00
|
|
|
only_if = tostring(self.file.url),
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|