Add ObjectElement and ICanvas support for it #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two commits that demonstrate the requested feature change.
I haven't tested this yet, but I thought it was easier to go ahead and present the idea in a new branch rather than continue back and forth in Discussion #78.
Basically, there's a new element called ObjectElement. It only has two properties: an Object and a FitSpaceBehavior.
When ObjectElement.Draw() is called, it calls ICanvas.DrawObject() passing the Object so the canvas has free control to analyze the object and decide how to draw it.
This allows custom implementations of ICanvas without limitation on what kinds of things can be drawn. And it avoids custom delegates everywhere you declare an ObjectElement. In the fluent builder construction, this allows the user to focus on "what" he is rendering instead of "how" to render it.
ISSUES:
I don't understand how your positioning system works yet. Right now the call to Canvas.DrawObject() passes Position.Zero. But I don't think that's correct. How do you pass the correct position to the ICanvas so it knows where to draw the element?