designsystemsinternational / mechanic

Mechanic is a framework to build assets built on web code.
https://mechanic.design
MIT License
251 stars 11 forks source link

Should we make "Scale to fit" more intuitive? #168

Open lucasdinonolte opened 1 year ago

lucasdinonolte commented 1 year ago

This is really more of a question and not a feature request. I stumbled across some "odd" behavior with the "Scale to fit" functionality – which isn't too odd if you think about the implementation of it, but I wanted to double check that this is intended behavior.

Context

When working on a Mechanic Prototype I found myself setting values for my sizes and border widths and so on by eye, based on what I saw in the preview. However when exporting at a larger size everything looked thinner and smaller because I had worked with absolute values (e.g. 300px width looked fine in scaled preview, but were too small in the non-scaled export).

From what I understand "Scale to fit" works with the width and height inputs directly and scales them. I understand the decision to it this way to be motivated by not only fitting the preview within the viewport but also keeping rendering performant for complex sketches by rendering them at a smaller size in preview.

It's obviously simple to work around this, by making all your widths and weights fractions of the canvas' width or height. I ended up defining my width not as 300px but as width * 0.25. I'm not saying this is not intuitive, but I think the above described behaviour can be a bit confusing to newer users.

Possible changes

runemadsen commented 1 year ago

This is a great point and something I have been thinking about too.

After having made interactive installations for large screens, I feel pretty strongly about the ability for "scale to fit" to renders a low-resolution version of the sketch during development. If you're making e.g. a 4K video, it's really nice not needing to render 4K while you're coding the sketch.

I like your idea of being more explicit about this in the documentation, and I also really like the idea of providing a utils function that can take this into account!

fdoflorenzano commented 1 year ago

Yeah it's not very intuitive and even I forget about it while mainly working on code and not exporting much, but I do agree it's important to have always. I've recently been forced to not being able to use the fit to size because of a particular use case, and not having the preview always fit really is a pain.

I agree making the docs more explicit about it should be good and having utils would be cool.