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 props.rotation === Rotation.Side
) { ) {
return css` return css`
width: 10vmin; width: 6vmax;
height: auto; height: auto;
`; `;
} }

View File

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

View File

@@ -311,14 +311,14 @@ const LifeCounter = ({
const fontSize = const fontSize =
player.settings.rotation === Rotation.SideFlipped || player.settings.rotation === Rotation.SideFlipped ||
player.settings.rotation === Rotation.Side player.settings.rotation === Rotation.Side
? `clamp(6rem, ${size}vmax, 10rem)` ? `${size}vmax`
: `clamp(6rem, ${size}vmin, 10rem)`; : `${size}vmin`;
const strokeWidth = const strokeWidth =
player.settings.rotation === Rotation.SideFlipped || player.settings.rotation === Rotation.SideFlipped ||
player.settings.rotation === Rotation.Side player.settings.rotation === Rotation.Side
? `clamp(0.4rem, ${size / 20}vmax, 12rem)` ? `${size / 20}vmax`
: `clamp(0.4rem, ${size / 20}vmin, 12rem)`; : `${size / 20}vmin`;
return ( return (
<LifeCounterContentWrapper backgroundColor={backgroundColor}> <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 ( return (
<SettingsContainer rotation={player.settings.rotation}> <SettingsContainer rotation={player.settings.rotation}>
<ColorPicker <ColorPicker
@@ -269,7 +275,7 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
userSelect: 'none', userSelect: 'none',
fontSize: '0.6rem', fontSize: buttonFontSize,
padding: '0 4px 0 4px', padding: '0 4px 0 4px',
}} }}
onClick={handleNewGame} onClick={handleNewGame}
@@ -281,7 +287,7 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
userSelect: 'none', userSelect: 'none',
fontSize: '0.6rem', fontSize: buttonFontSize,
padding: '0 4px 0 4px', padding: '0 4px 0 4px',
}} }}
onClick={toggleFullscreen} onClick={toggleFullscreen}
@@ -293,7 +299,7 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
userSelect: 'none', userSelect: 'none',
fontSize: '0.6rem', fontSize: buttonFontSize,
padding: '0 4px 0 4px', padding: '0 4px 0 4px',
}} }}
onClick={handleWakeLock} onClick={handleWakeLock}