Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support grid system in a bounding box #469

Open
zinkkrysty opened this Issue · 4 comments

4 participants

@zinkkrysty

This is feature/would-be-nice, but it would really be nice if you support creating a grid system inside a bounding box.

There are some things you can't do with a table and grid layout is more flexible. And I don't want to specify the grid for the whole document, just a small part of it.

@practicingruby

This is a good idea! Sorry for taking so long to respond. Re-opening because I feel that the right scoping for the grid system is definitely by the current bounds rather than document-wide.

@skandragon

I'm not sure if I stumbled on this or not, but I ran this code, and it works as intended -- I end up with a 100 x 100 area with a locally defined grid, and a second area with a 200 x 200 locally defined grid.

  bounding_box([0, 100], height: 100, width: 100) do
    line_width 0.5
    define_grid(columns: 4, rows: 4, gutter: 0)

    grid.show_all

    grid([0, 0], [2, 2]).bounding_box do
      stroke_bounds
    end
  end

  bounding_box([200, 200], height: 200, width: 200) do
    line_width 0.5
    define_grid(columns: 8, rows: 8, gutter: 0)

    grid.show_all

    grid([0, 0], [2, 2]).bounding_box do
      stroke_bounds
    end
  end
@practicingruby

@skandragon: A while back it was impossible to redefine the grid at all, due to a caching bug. Now it's possible to redefine as many times as you'd like, but the problem is that there can only be one active grid at a time in the document.

So that makes it possible for your example to work, but not for a nested grid structure to work. It's also a little clunky because of the destructive behavior of define_grid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.