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

Scale promo piece size relative to screen width #2111

Merged

Conversation

jas14
Copy link
Collaborator

@jas14 jas14 commented May 15, 2022

Fixes #2074.

Description

Promo pieces are currently scaled to 60x60px, which gets too big when the base zoom is scaled up or down, as detailed in the linked issue.

To make the promo overlay pieces the same size as the pieces on the board, this PR essentially aims to change the promo piece height and width to 12.5% of the overlay (and screen) width. It will consequently often match the board piece width, and is in any case reasonably legible.

In order to actually match the height to 12.5% of width, I had to write a CSS hack, as indicated by a comment. I also capped the piece width/height at 100% of the overlay height in order to keep the pieces within the overlay bounds in edge-case font/screen configurations.

Lastly, I took the liberty of making the promo overlay a flex component. This might not have been necessary but I found it slightly easier to reason about. Happy to revert that bit if desired.

New styling with various screen widths

lichobile.promo.piece.adjustment.width.mov

New styling with various base zooms

Note that zoom adjustments affect the base px size; since the overlay height and column gap are specified in px, they're subject to change size too.

lichobile.promo.piece.font.adjustment.mov

@veloce veloce merged commit 8d70b11 into lichess-org:master Jun 6, 2022
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

Successfully merging this pull request may close these issues.

Samsung S21: Piece promotion view distorted, misaligned due to large promotion images
2 participants