adjust scaling

This commit is contained in:
Viktor Rådberg
2023-09-01 18:29:35 +02:00
parent a1a51b727e
commit 3d036e6026
4 changed files with 24 additions and 9 deletions

View File

@@ -51,7 +51,7 @@ const CommanderDamageButton = styled.button<{
props.rotation === Rotation.Side
) {
return css`
width: 10vmin;
width: 6vmax;
height: auto;
`;
}

View File

@@ -9,7 +9,6 @@ export const StyledLifeCounterButton = styled.button`
width: 100%;
height: 100%;
color: rgba(0, 0, 0, 0.4);
font-size: 4rem;
font-weight: 600;
background-color: transparent;
border: none;
@@ -35,6 +34,7 @@ const TextContainer = styled.div<{
rotation: number;
}>`
position: relative;
top: -10%;
${(props) => {
if (
@@ -45,10 +45,13 @@ const TextContainer = styled.div<{
return css`
rotate: -90deg;
bottom: 25%;
left: -10%;
top: auto;
`;
}
return css`
rotate: -90deg;
left: -10%;
top: 25%;
`;
}
@@ -111,6 +114,11 @@ const LifeCounterButton = ({
setHasPressedDown(false);
};
const fontSize =
rotation === Rotation.SideFlipped || rotation === Rotation.Side
? '10vmax'
: '20vmin';
return (
<StyledLifeCounterButton
onPointerDown={handleDownInput}
@@ -119,6 +127,7 @@ const LifeCounterButton = ({
onContextMenu={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.preventDefault();
}}
style={{ fontSize }}
>
<TextContainer
rotation={rotation}

View File

@@ -311,14 +311,14 @@ const LifeCounter = ({
const fontSize =
player.settings.rotation === Rotation.SideFlipped ||
player.settings.rotation === Rotation.Side
? `clamp(6rem, ${size}vmax, 10rem)`
: `clamp(6rem, ${size}vmin, 10rem)`;
? `${size}vmax`
: `${size}vmin`;
const strokeWidth =
player.settings.rotation === Rotation.SideFlipped ||
player.settings.rotation === Rotation.Side
? `clamp(0.4rem, ${size / 20}vmax, 12rem)`
: `clamp(0.4rem, ${size / 20}vmin, 12rem)`;
? `${size / 20}vmax`
: `${size / 20}vmin`;
return (
<LifeCounterContentWrapper backgroundColor={backgroundColor}>

View File

@@ -156,6 +156,12 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
}
};
const buttonFontSize =
player.settings.rotation === Rotation.SideFlipped ||
player.settings.rotation === Rotation.Side
? '1.3vmax'
: '2.5vmin';
return (
<SettingsContainer rotation={player.settings.rotation}>
<ColorPicker
@@ -269,7 +275,7 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
style={{
cursor: 'pointer',
userSelect: 'none',
fontSize: '0.6rem',
fontSize: buttonFontSize,
padding: '0 4px 0 4px',
}}
onClick={handleNewGame}
@@ -281,7 +287,7 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
style={{
cursor: 'pointer',
userSelect: 'none',
fontSize: '0.6rem',
fontSize: buttonFontSize,
padding: '0 4px 0 4px',
}}
onClick={toggleFullscreen}
@@ -293,7 +299,7 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
style={{
cursor: 'pointer',
userSelect: 'none',
fontSize: '0.6rem',
fontSize: buttonFontSize,
padding: '0 4px 0 4px',
}}
onClick={handleWakeLock}