question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add setWidthFromRatio and setHeightFromRatio to Settings

See original GitHub issue

Example usage: (when width or height is known and the other aspect needs to be set using a specific ratio)

settings.setWidth(800);
settings.setHeightFromRatio(16 / 9);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shubhankarb180commented, Oct 7, 2019

@nandhae You can work too. I was not able to add as I don’t know much kotlin.

0reactions
nandhaecommented, Oct 7, 2019

@AlmasB Raised a PR #675 with two simple functions which takes ratio as a fraction. The clarifications i would be needing are,

  1. Assumed that ratio would be fraction and did not try to read as string. Eg: “16:9”. Please verify if this is okay.
  2. Rounded result height and width to int. Worried if it will have precision errors.
  3. Could not add unit tests, since I could not access these methods in “GameSettingsTest”

Any suggestions or directions on these points would help. Would be happy to refactor and enhance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set height as a ratio of width with only css - html
CSS has a built-in property called aspect-ratio just assign it to the element after height or width has been defined. CSS-tricks has an...
Read more >
How To - Aspect Ratio / Height Equal to Width
The aspect ratio of an element describes the proportional relationship between its width and its height. Two common video aspect ratios are 4:3...
Read more >
aspect-ratio - CSS: Cascading Style Sheets - MDN Web Docs
The aspect-ratio CSS property sets a preferred aspect ratio for the box ... The box's preferred aspect ratio is the specified ratio of...
Read more >
aspect-ratio
The CSS property aspect-ratio lets you create boxes that maintain proportional dimensions where the height and width of a box are calculated ...
Read more >
New aspect-ratio CSS property supported in Chromium, Safari ...
Maintaining aspect ratio within images and elements is now easier to ... setting aspect-ratio to a specified ratio of width / height ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found