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

Aspect ratio on Mobile #528

Closed
lstump opened this issue Jul 19, 2019 · 2 comments
Closed

Aspect ratio on Mobile #528

lstump opened this issue Jul 19, 2019 · 2 comments

Comments

@lstump
Copy link

lstump commented Jul 19, 2019

Thank you for your helpful project!

If I layout my items on a grid with multiple columns (say 12 columns) and then shrink the viewport down to mobile size, my items are resized ONLY according to their height (in rows) without their width (in columns) being taken into account. This means that 'large' grid items (say 4 columns by 3 rows) become much taller on the mobile without regard to their original aspect ratio. Such items go from 4:3 to 2:3. Note that their actual width at the mobile break point is much wider than their actual width BEFORE the breakpoint, but their relative height suddenly doubles. In other words, all of my items show up way larger on the mobile without needing to.

If I change the line in GridsterRenderer:UpdateItem
FROM
renderer.setStyle(el, 'height', (this.gridster.curWidth / 2 * item.rows) + 'px');
TO
renderer.setStyle(el, 'height', (item.rows * this.gridster.curWidth / item.cols ) + 'px');

It does the trick for me, but I'm sure it would break other people to whom preservation of the relative areas of the grid items is more important than preserving their aspect ratios...

Do you have any suggestions for me?

Thanks!!!

@tiberiuzuld
Copy link
Owner

Hi @lstump ,
I think that you are right that we should keep the aspect ratio.
I like your solution to it, I think I will make the change and see if anyone complains :D
Seems a better solution than the current one.

Thanks

@tiberiuzuld
Copy link
Owner

Deployed in v8.1.0

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

2 participants