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

Document and maybe integrate "blocks" or "cells" for easy grid layouts #294

Closed
andymeneely opened this issue Feb 1, 2020 · 4 comments
Closed

Comments

@andymeneely
Copy link
Owner

andymeneely commented Feb 1, 2020

Heard about this neat little monkeypatch from @mzemel. This snippet: https://github.com/mzemel/whipped/blob/a31cd0fcb19223755e33b1edbc0f0343448134aa/deck.rb#L4-L14

So you can then align things like 3.blocks in your code easily without doing multiplication in your head.

At the very least, we could document this.

We could also introduce a "block" or "cell" as a custom unit that defaults to 37.5. That way you can have a layout file that says:

cut:
  x: 1 cell
  y: 1 cell
@andymeneely andymeneely changed the title Document and maybe integrate "blocks" or "cells Document and maybe integrate "blocks" or "cells" for easy grid layouts Feb 1, 2020
@mzemel
Copy link

mzemel commented Feb 2, 2020

Hey @andymeneely, I've put together a "halfway" concept:

#295

Right now, it's looking like it'll be tricky to support x: 2cells in the layout file, since the layout parser doesn't have access to instance variables set in deck.rb.

Here's an example of cells(2) in a deck.rb file. So that reads well...

But I'm not loving the asymmetry of a unit available in deck.rb, but not in layout.yml. Also, it seems like the "squib way" is to put all/most options in the layout.yml file.

We could say cell_size is customizable within the scope of deck.rb but is always 37.5px in the layout files.. but that seems like a debugging headache waiting to happen to someone.

What are your thoughts? Happy to move forward with a PR and call out the asymmetry in the documentation, or shelve it for another time :)

@qrunchmonkey
Copy link

big, big +1 on this issue.

I agree that having a different cell_size in yaml vs. in ruby would a nightmare, and make this feature mostly worthless.

I haven't checked out the associated PR yet, but looking at how DPI is passed to layout_parser.rb , I don't see a good reason why the grid size couldn't be passed the same way. Conceptually DPI and cell size are the same kind of thing - both are a scaling factor applied to unit conversion.

I'd encourage you to not complicate this by having non-square cells, gutters, or anything like that. This feature would be amazing for rapidly prototyping cards on graph paper and/or in code. It doesn't need to be anything more.

@andymeneely
Copy link
Owner Author

Yeah adding a custom unit shouldn't be hard at all. I'll be picking up my Squib work soon and will do something like this. And it'll work the same between yaml and ruby. You'll be able to modify the size of a "cell" as a config setting and it'll default to 75px or 1/8in.

@andymeneely
Copy link
Owner Author

This is going to be part of v0.16!

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

No branches or pull requests

3 participants