The complexity depends on your use. From the idea that you want partial update, I assume you do not use the display real estate in a scrolling manner. In other words, each information is always displayed in the same space, but sometimes it uses less and sometimes it uses more of that space. After all, you have to manage anyway that not too much is displayed because it would overwrite / reach into something else - when you have things side by side - and 'fall off the cliff' because it is too long to fit. and will get cut off.
With these assumption you create a function for each information you display. The first thing that this function does is clearing out the space using .fillRect(...).
This pattern can then be generalized, as you said that you are thinking of pages with fields on it. Create a Renderer that uses the visitor pattern to traverse a PageDefinition, which consists of an array of DisplayItems. Each DisplayItems contains just what you need:
© Espruino, powered by microcosm.
Report a problem