Skip to content

v1.4/2.0: Widged redraw(self) method signature changes to redraw(self, x, y) #59

Description

@pfalcon

What: Widget.redraw(self) (and all subclasses) change to Widget.redraw(self, x, y). Widgets are now expected to store coordinates relative to their parents (instead of absolute screen coordinates). Parents pass their (absolute) coordinates as arguments to children' .redraw(x, y) methods. Children add these coordinate arguments to their own (relative) coordinates for drawing.

Why: Originally, picotui was intended to be as efficient and simple as possible. That's why coordinates were calculated just once and used as is. Any geometry management was considered out of scope of the library. While that remains true, there's a desire to make some simple/common scenarios easier. E.g., when screen is resized, a user may want to keep a dialog box centered on it. Currently, that requires going over all child widgets of a dialog and recalculating their (absolute) coordinates. While definitely possible, and how it was intended to be done originally, after additional experience and feedback, and I'd like to simplify that so only coordinates of the dialog itself need to be updated.

When: feedback is welcome whether this change should be dubbed 1.3 (or 1.4) or 2.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions