Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ObjectElement and ICanvas support for it #80

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pha3z
Copy link

@pha3z pha3z commented Dec 21, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant