Replies: 2 comments 1 reply
-
What a great Idea |
Beta Was this translation helpful? Give feedback.
-
I thought about it some more, and here are some thoughts on where we could go with this. Make a class that is an Instance. An Instance holds a Value (model) and a reference to the corresponding ViewItem (view). The Value is what currently is called the CanvasItem, but it would not subclass from Goo.CanvasItem. The hierarchy is as follows:
Whenever a change is made to the value of an item, there needs to be a synchronization step to update the view. But multiple changes can happen before a synchronization happens. The source of truth here is always the Value. Eventually we could have values actually have value semantics or similar. This would provide certain nice guarantees. |
Beta Was this translation helpful? Give feedback.
-
Right now components and items and goocanvas are very interconnected in ways that make it hard to modularize them, build clean implementations on top of it, and eventually migrate from goo canvas.
I think we need to discuss how we may want to address this. To start, I want to propose having a few unbreakable rules to guide us in the right direction:
A first step here would be to extirpate the synchronization of components and items out of the component code itself. One step in the right direction would be to add a "dirty" state to components. Items would then have a "update_components" command that would check for any dirty components and run the necessary code to synchronize the component to the item. The synchronization code itself should be static (for now it could live in each component) function / method that updates the item and marks the component as not dirty.
The second step would be to have items not require a canvas or artboard when being constructed. This would allow better prepping of items before being inserted to the canvas. It would also allow for better deep-copying and other operations.
These are some initial thoughts, but I think it'd be nice to start moving in this direction as soon as possible.
Beta Was this translation helpful? Give feedback.
All reactions