Code Monkey home page Code Monkey logo

Comments (2)

jonhoo avatar jonhoo commented on July 30, 2024 1

I think the trick here will be something along the lines of:

  • Set all "internal" widths in percent (i.e., everything except the canvas)
  • If the user sets a width, use that as the width of the canvas.
  • Otherwise, don't set a width for the canvas, which I believe will cause it to be "whatever width is available".

You're totally right that this'll break with upstream default behavior, but I'm okay with that in this instance.

We may have to fiddle with the zoom code in javascript too to get the zoom to work correctly. Alternatively, I'd like us to move the zoom to use viewbox instead, but that may be a bigger task. This article may help in figuring out how to set things correctly. We're in a bit of a special case since we mostly don't care about aspect ratio, but I think we could figure something out.

I don't think we should allow percentage widths as arguments. I don't really see a use for it. I don't even really see a use for --width except when combined with height-related attributes to try to get a particular aspect ratio. I'm almost inclined to deprecate --width (it's an SVG after all!), but that might be taking it too far.

from inferno.

jasonrhansen avatar jasonrhansen commented on July 30, 2024

Since we have an option to set the image width in pixels, we need to decide how this feature will affect that.

Should we keep the default width set to 1200 pixels to match upstream, or would you rather have 100% as the default?

Do we want to enhance the width option to allow percentages in addition to pixels? So --width=1200 means 1200 pixels, but --width=60% means 60%?

from inferno.

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.