-
Notifications
You must be signed in to change notification settings - Fork 89
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
node width and height should be optional #15
Comments
I plan to start my work on this, was wondering if just setting the height and width to 100% should be the fix or just remove the explicit width and height variables? |
my first impression of |
I do not agree with this - without explicit widths and heights, there is no way for an engine to consistently layout nodes properly. Especially with auto-formatting text, should the engine fit all text on a single line, or some default width and then wrap the lines? How would the engine size two cards that are side-by-side but would otherwise run into each other without explicit widths? The other issue is with text sizing and font. Different apps will have different font sizes, text layout algorithm, and text wrapping algorithms. Without explicit sizing it will make canvases on one app look completely different on another app. What I think would make sense, is to always require width for text nodes - having a specified/required width makes layout at least somewhat predictable. Auto-sizing text can dynamically determine the height based on how much space the text ends up being formatted as. Even then I would argue that this could work for some kind of user content (like a row of cards) but not for others (like a kanban, where cards are stacked below others) because you can still run into issues where cards auto-size to different sizes and run into another card below. |
In the case of kinopio and some other canvas apps I've seen, nodes have a default width before text starts to wrap - but the user can optionally explicitly adjust the width at which wrapping occurs. Some nodes will have this width explicitly set, other nodes will not.
Importing content that appears broken or malformed in an app for the sake of dogmatic consistency seems like an anti goal to me. If node size is important than it can be explicitly specified in the canvas file.
this is exactly what I proposed: that |
So you're saying leave the width as it is and just adjust the height to 100%? Also I checked that the node -text height is fixed which makes setting the height to 100% efficient?
|
Right, I guess it depends on the target use case of the app, but IMO from a specifications perspective leaving this to the implementation leads to poor user experience as nodes will be rendered significantly differently across apps with different defaults, font sizes, and text wrapping algorithms. If there's any consensus that these are to be marked as optional, then I would still suggest setting them for interoperability between apps and consistency, and require that the specification explicitly state the algorithm to be followed for missing width/height values.
I believe the whole point of a specification is for apps to be able to share content in a predictable way and not have content appear broken or malformed when going from one app to another. If content becomes broken then there's no point in having a standard format, no?
Apologies, my original use of "determined" was supposed to mean "specified", as in that it's specified (required) in the format. I will revise my earlier comment. |
Do you mean by |
Yeah that's what I meant. I agree on your suggestion
|
One thing to consider is that marking width or height optional would inadvertently lead to requiring the implementers to deal with the possibility of a nonexistent value. The downside here is the additional implementation burden that one would have to follow a proposed algorithm to consistently (or at least, gracefully) render the contents. On the flip side, the specification could also call out that null/undefined or zero values be handled in the same way. |
wouldn’t that just be the default value that the app is already using when width hasn’t been explicitly specified by the user ? |
Just a note that at present, there is no way of setting a height or width to a percentage (regardless of how that percentage might be interpreted); only integer pixel values are allowed in the spec. In this case (specifically supporting an infinite canvas), having a percentage match the size of the container (which may be the canvas) doesn't make sense, as any percentage of infinity but 0 is infinity. |
For importing, Kinopio computes a node's dimensions dynamically based on it's contents so explicit width and height are unnecessary in my context (manual resizing is an optional action that the user can take). Also because Kinopio's design also has to work on mobile, Kinopio cards might have more padding or a larger default font size than other apps.
But also going the other way with exporting, the width and heights that kinopio uses might look wonky in another app so I can specify them but I wouldn't want them to be treated as gospel elsewhere.
The text was updated successfully, but these errors were encountered: