Git Product home page Git Product logo

Comments (11)

capak07 avatar capak07 commented on September 26, 2024 1

Yeah that's what I meant. I agree on your suggestion

My suggestion is to keep the width fixed and mandatory, and consider the possibility of letting the height be optional.

from jsoncanvas.

capak07 avatar capak07 commented on September 26, 2024

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?

from jsoncanvas.

pketh avatar pketh commented on September 26, 2024

my first impression of 100% is that it would be 100% of the width of the page (like width:100% in css). If width and height are optional, then the importing app can make it's own width determination based on the node content. It might even want to do that even if width and height are specified because of differences between apps imo.

from jsoncanvas.

lishid avatar lishid commented on September 26, 2024

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.

from jsoncanvas.

pketh avatar pketh commented on September 26, 2024

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?

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.

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.

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.

having a determined 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.

this is exactly what I proposed: that determined width is determined by the importing app when an explicit node width is not specified

from jsoncanvas.

capak07 avatar capak07 commented on September 26, 2024

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?

What I think would make sense, is to always require width for text nodes - having a determined width makes layout at least somewhat predictable

from jsoncanvas.

lishid avatar lishid commented on September 26, 2024

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.

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.

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.

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?

this is exactly what I proposed: that determined width is determined by the importing app when an explicit node width is not specified

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.

from jsoncanvas.

lishid avatar lishid commented on September 26, 2024

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?

Do you mean by 100% to be the equivalent of the css rule "fit-content"? My suggestion is to keep the width fixed and mandatory, and consider the possibility of letting the height be optional.

from jsoncanvas.

lishid avatar lishid commented on September 26, 2024

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.

from jsoncanvas.

pketh avatar pketh commented on September 26, 2024

requiring the implementers to deal with the possibility of a nonexistent value

wouldn’t that just be the default value that the app is already using when width hasn’t been explicitly specified by the user ?

from jsoncanvas.

clbarnes avatar clbarnes commented on September 26, 2024

my first impression of 100% is that it would be 100% of the width of the page (like width:100% in css)

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.

from jsoncanvas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.