Inky icon indicating copy to clipboard operation
Inky copied to clipboard

Prerender function

Open iamcxds opened this issue 11 months ago • 0 comments

When I try to create a text field that change h depend on w so I define elem.props.w and elem.props.h, If I use useEffect to update h by w, and the draw function is like

function (self, x, y, w, h)
self.props.w=w
...
end

And finally I want to call elem:render(x, y, w, elem.props.h)

These code I have some problems:

  1. Before first render, props.h is nil, so I have to set a default value.
  2. The update is after this frame, this can cause some problem if I have chain of update.

So I wonder, maybe it can be solved by add prerender function to do something before render?

iamcxds avatar Feb 18 '25 21:02 iamcxds