feat: scrolling

This commit is contained in:
2026-08-06 09:05:02 -04:00
parent 26f3fdb6e6
commit e5ed980294
9 changed files with 527 additions and 37 deletions
+18 -2
View File
@@ -85,6 +85,22 @@ function tree.hit(root, x, y) end
---@return integer h
function tree.getRect(id) end
---Pans a scrollable node's children, clamped to the content. The node is marked dirty, so the next draw repaints it.
---@param id NodeId
---@param x integer
---@param y integer
function tree.setScroll(id, x, y) end
---Returns a scrollable node's current offset, or zeroes.
---@param id NodeId
---@return integer x, integer y
function tree.getScroll(id) end
---Returns how far each axis can pan before the content's far edge reaches the box. Zero on an axis whose content fits.
---@param id NodeId
---@return integer maxX, integer maxY
function tree.getScrollRange(id) end
---Replaces a node's text and marks it for repaint.
---@param id NodeId
---@param text string
@@ -138,8 +154,8 @@ function tree.getFocus() end
---@return NodeId? focused Current focus when no candidate exists.
function tree.moveFocus(root, direction) end
---Registers the painter every custom node calls.
---@param painter fun(id: NodeId, x: integer, y: integer, w: integer, h: integer)
---Registers the painter every custom node calls. The clip arguments are the region of the node being painted now -- one band of a composited repaint -- so a painter can cull to it instead of redrawing itself once per band.
---@param painter fun(id: NodeId, x: integer, y: integer, w: integer, h: integer, clipX: integer, clipY: integer, clipW: integer, clipH: integer)
function tree.setPainter(painter) end
---Paints dirty nodes; the firmware owns publication to the physical display.