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

Calculating height of row in fixed-partition mode with spacing enabled #3

Open
thijsw opened this issue Jun 28, 2016 · 1 comment
Open

Comments

@thijsw
Copy link

thijsw commented Jun 28, 2016

With the following set up, the algorithm yield the results display below:

import layout from 'image-layout/layouts/fixed-partition'

const elements = [
  {"width":800,"height":536},
  {"width":708,"height":800},
  {"width":800,"height":536}
]

const result = layout(elements, {
  containerWidth: 1200,
  idealElementHeight: 280,
  spacing: 40
})
{
  "width": 1200,
  "height": 310,
  "positions": [
    {
      "y": 0,
      "x": 0,
      "width": 432,
      "height": 310
    },
    {
      "y": 0,
      "x": 472,
      "width": 256,
      "height": 310
    },
    {
      "y": 0,
      "x": 768,
      "width": 432,
      "height": 310
    }
  ]
}

Given the aspect ratio of the images, I'd expect the row to have a height of 290px instead of 310px. When spacing is set to 0 I get results that respect the aspect ratio. Do I miss something?

@johanneseckert
Copy link

I see the same issues, larger gutters put the images out of aspect ratio

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

No branches or pull requests

2 participants