mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-18 16:58:01 +00:00
fix rotations
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import styled, { css, keyframes } from 'styled-components';
|
import styled, { css, keyframes } from 'styled-components';
|
||||||
|
import { theme } from '../../Data/theme';
|
||||||
import { Player, Rotation } from '../../Types/Player';
|
import { Player, Rotation } from '../../Types/Player';
|
||||||
import LifeCounterButton from '../Buttons/LifeCounterButton';
|
import LifeCounterButton from '../Buttons/LifeCounterButton';
|
||||||
import SettingsButton from '../Buttons/SettingsButton';
|
import SettingsButton from '../Buttons/SettingsButton';
|
||||||
@@ -7,7 +8,6 @@ import CommanderDamageBar from '../Counters/CommanderDamageBar';
|
|||||||
import ExtraCountersBar from '../Counters/ExtraCountersBar';
|
import ExtraCountersBar from '../Counters/ExtraCountersBar';
|
||||||
import { OutlinedText } from '../Misc/OutlinedText';
|
import { OutlinedText } from '../Misc/OutlinedText';
|
||||||
import PlayerMenu from '../PlayerMenu/PlayerMenu';
|
import PlayerMenu from '../PlayerMenu/PlayerMenu';
|
||||||
|
|
||||||
const LifeCounterContentWrapper = styled.div<{
|
const LifeCounterContentWrapper = styled.div<{
|
||||||
backgroundColor: string;
|
backgroundColor: string;
|
||||||
}>`
|
}>`
|
||||||
@@ -88,8 +88,7 @@ const StartingPlayer = styled.div<{
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 8vmin;
|
background: ${theme.palette.primary.main};
|
||||||
background: turquoise;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
-webkit-touch-callout: none;
|
-webkit-touch-callout: none;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
@@ -97,13 +96,28 @@ const StartingPlayer = styled.div<{
|
|||||||
-moz-user-select: -moz-none;
|
-moz-user-select: -moz-none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
|
|
||||||
${(props) => {
|
${(props) => {
|
||||||
if (
|
if (
|
||||||
props.rotation === Rotation.SideFlipped ||
|
props.rotation === Rotation.SideFlipped ||
|
||||||
props.rotation === Rotation.Side
|
props.rotation === Rotation.Side
|
||||||
) {
|
) {
|
||||||
return css`
|
return css`
|
||||||
flex-direction: column-reverse;
|
rotate: ${props.rotation - 90}deg;
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StartingPlayerText = styled.div<{ rotation: Rotation }>`
|
||||||
|
font-size: 8vmin;
|
||||||
|
${(props) => {
|
||||||
|
if (
|
||||||
|
props.rotation === Rotation.SideFlipped ||
|
||||||
|
props.rotation === Rotation.Side
|
||||||
|
) {
|
||||||
|
return css`
|
||||||
|
rotate: ${props.rotation - 180}deg;
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -236,10 +250,11 @@ const LifeCounter = ({
|
|||||||
<LifeCounterWrapper rotation={player.settings.rotation}>
|
<LifeCounterWrapper rotation={player.settings.rotation}>
|
||||||
{player.isStartingPlayer && !showStartingPlayer && (
|
{player.isStartingPlayer && !showStartingPlayer && (
|
||||||
<StartingPlayer rotation={player.settings.rotation}>
|
<StartingPlayer rotation={player.settings.rotation}>
|
||||||
|
<StartingPlayerText rotation={player.settings.rotation}>
|
||||||
You start!
|
You start!
|
||||||
|
</StartingPlayerText>
|
||||||
</StartingPlayer>
|
</StartingPlayer>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<CommanderDamageBar
|
<CommanderDamageBar
|
||||||
opponents={opponents}
|
opponents={opponents}
|
||||||
player={player}
|
player={player}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const ButtonsSections = styled.div<{ rotation: Rotation }>`
|
|||||||
props.rotation === Rotation.Side
|
props.rotation === Rotation.Side
|
||||||
) {
|
) {
|
||||||
return css`
|
return css`
|
||||||
rotate: ${props.rotation}deg;
|
rotate: ${props.rotation - 180}deg;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -293,13 +293,9 @@ const Settings = ({ player, onChange, resetCurrentGame }: SettingsProps) => {
|
|||||||
</TogglesSection>
|
</TogglesSection>
|
||||||
|
|
||||||
<ButtonsSections rotation={player.settings.rotation}>
|
<ButtonsSections rotation={player.settings.rotation}>
|
||||||
<Button rotation={player.settings.rotation} onClick={handleNewGame}>
|
<Button onClick={handleNewGame}>Back to Start</Button>
|
||||||
Back to Start
|
<Button onClick={toggleFullscreen}>Fullscreen</Button>
|
||||||
</Button>
|
<Button onClick={handleWakeLock}>
|
||||||
<Button rotation={player.settings.rotation} onClick={toggleFullscreen}>
|
|
||||||
Fullscreen
|
|
||||||
</Button>
|
|
||||||
<Button rotation={player.settings.rotation} onClick={handleWakeLock}>
|
|
||||||
{released === false ? 'Release' : 'Request'} nosleep
|
{released === false ? 'Release' : 'Request'} nosleep
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonsSections>
|
</ButtonsSections>
|
||||||
|
|||||||
Reference in New Issue
Block a user