ios fixes, settings for ios and desktop

This commit is contained in:
Viktor Rådberg
2023-07-04 23:39:31 +02:00
parent b170013ce9
commit cf84f4f66c
10 changed files with 141 additions and 9 deletions

View File

@@ -5,8 +5,8 @@ import styled from 'styled-components';
import { Player } from './Types/Player'; import { Player } from './Types/Player';
const MainWrapper = styled.div` const MainWrapper = styled.div`
width: 100dvw; width: 100vw;
height: 100dvh; height: 100vh;
overflow: hidden; overflow: hidden;
min-width: 254px; min-width: 254px;
`; `;
@@ -115,10 +115,14 @@ function App() {
const handleFullscreen = () => { const handleFullscreen = () => {
const element = document.documentElement; const element = document.documentElement;
if (isFullscreen) { if (!isFullscreen) {
document.exitFullscreen(); if (element.requestFullscreen) {
element.requestFullscreen();
}
} else { } else {
element.requestFullscreen(); if (document.exitFullscreen) {
document.exitFullscreen();
}
} }
setIsFullscreen(!isFullscreen); setIsFullscreen(!isFullscreen);

View File

@@ -14,6 +14,11 @@ export const StyledLifeCounterButton = styled.button<{ align?: string }>`
padding: 0 28px; padding: 0 28px;
text-align: ${(props) => props.align || 'center'}; text-align: ${(props) => props.align || 'center'};
user-select: none; user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
type AddLifeButtonProps = { type AddLifeButtonProps = {
@@ -62,6 +67,18 @@ const AddLifeButton = ({ lifeTotal, setLifeTotal }: AddLifeButtonProps) => {
onContextMenu={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { onContextMenu={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.preventDefault(); e.preventDefault();
}} }}
onTouchStart={(e: React.TouchEvent<HTMLButtonElement>) => {
e.preventDefault();
}}
onTouchEnd={(e: React.TouchEvent<HTMLButtonElement>) => {
e.preventDefault();
}}
onTouchMove={(e: React.TouchEvent<HTMLButtonElement>) => {
e.preventDefault();
}}
onTouchCancel={(e: React.TouchEvent<HTMLButtonElement>) => {
e.preventDefault();
}}
align="right" align="right"
> >
&#43; &#43;

View File

@@ -24,6 +24,13 @@ const CommanderDamageButton = styled.button<{ backgroundColor?: string }>`
outline: none; outline: none;
cursor: pointer; cursor: pointer;
background-color: ${(props) => props.backgroundColor || 'antiquewhite'}; background-color: ${(props) => props.backgroundColor || 'antiquewhite'};
margin: 0;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
const CommanderDamageButtonText = styled.p` const CommanderDamageButtonText = styled.p`
@@ -35,10 +42,15 @@ const CommanderDamageButtonText = styled.p`
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
pointer-events: none; pointer-events: none;
width: 2rem; width: 2rem;
user-select: none;
text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff,
1px 1px 0 #ffffff; 1px 1px 0 #ffffff;
color: #000000; color: #000000;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
const VerticalSeperator = styled.div` const VerticalSeperator = styled.div`

View File

@@ -9,6 +9,11 @@ export const StyledExtraCounterButton = styled.button`
cursor: pointer; cursor: pointer;
background-color: transparent; background-color: transparent;
user-select: none; user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
export const CenteredText = styled.div` export const CenteredText = styled.div`
@@ -21,6 +26,12 @@ export const CenteredText = styled.div`
text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff,
1px 1px 0 #ffffff; 1px 1px 0 #ffffff;
color: #000000; color: #000000;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
type ExtraCounterProps = { type ExtraCounterProps = {

View File

@@ -0,0 +1,33 @@
import styled from 'styled-components';
import SettingsIcon from '../../Icons/SettingsIcon';
export const StyledExtraCounterButton = styled.button`
position: relative;
flex-grow: 1;
border: none;
outline: none;
cursor: pointer;
margin-bottom: -5vh;
top: 8px;
background-color: transparent;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`;
type SettingsButtonProps = {
onClick: () => void;
};
const SettingsButton = ({ onClick }: SettingsButtonProps) => {
return (
<StyledExtraCounterButton onClick={onClick}>
<SettingsIcon size="4vh" />
</StyledExtraCounterButton>
);
};
export default SettingsButton;

View File

@@ -14,6 +14,11 @@ export const StyledLifeCounterButton = styled.button<{ align?: string }>`
padding: 0 28px; padding: 0 28px;
text-align: ${(props) => props.align || 'center'}; text-align: ${(props) => props.align || 'center'};
user-select: none; user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
type SubtractLifeButtonProps = { type SubtractLifeButtonProps = {

View File

@@ -41,10 +41,15 @@ export const LifeCounterText = styled.p`
width: 100%; width: 100%;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
pointer-events: none; pointer-events: none;
user-select: none;
text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff,
1px 1px 0 #ffffff; 1px 1px 0 #ffffff;
color: #000000; color: #000000;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
-moz-user-select: -moz-none;
-webkit-user-select: none;
-ms-user-select: none;
`; `;
export const ExtraCountersGrid = styled.div` export const ExtraCountersGrid = styled.div`

View File

@@ -13,6 +13,7 @@ import EnergyIcon from '../../Icons/EnergyIcon';
import ExperienceIcon from '../../Icons/ExperienceIcon'; import ExperienceIcon from '../../Icons/ExperienceIcon';
import PoisonIcon from '../../Icons/PoisonIcon'; import PoisonIcon from '../../Icons/PoisonIcon';
import PartnerTaxIcon from '../../Icons/PartnerTaxIcon'; import PartnerTaxIcon from '../../Icons/PartnerTaxIcon';
import SettingsButton from '../Buttons/SettingsButton';
type LifeCounterProps = { type LifeCounterProps = {
player: Player; player: Player;
@@ -49,6 +50,11 @@ const LifeCounter = ({
setLifeTotal={handleLifeChange} setLifeTotal={handleLifeChange}
opponents={opponents} opponents={opponents}
/> />
<SettingsButton
onClick={() => {
setShowPlayerMenu(!showPlayerMenu);
}}
/>
<S.LifeCountainer> <S.LifeCountainer>
<SubtractLifeButton <SubtractLifeButton
lifeTotal={player.lifeTotal} lifeTotal={player.lifeTotal}

View File

@@ -1,6 +1,6 @@
import { IconProps } from '../Types/Icon'; import { IconProps } from '../Types/Icon';
const PhyrexianIcon = ({ color, size }: IconProps) => { const PoisonIcon = ({ color, size }: IconProps) => {
return ( return (
<div style={{ position: 'relative', display: 'inline-block' }}> <div style={{ position: 'relative', display: 'inline-block' }}>
<svg <svg
@@ -18,4 +18,4 @@ const PhyrexianIcon = ({ color, size }: IconProps) => {
); );
}; };
export default PhyrexianIcon; export default PoisonIcon;

View File

@@ -0,0 +1,39 @@
import { IconProps } from '../Types/Icon';
const SettingsIcon = ({ color, size }: IconProps) => {
return (
<div style={{ position: 'relative', display: 'inline-block' }}>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlSpace="preserve"
viewBox="0 0 182.000000 182.000000"
width={size}
height={size}
fill={color || 'black'}
fillOpacity="0.3"
>
<g transform="translate(0.000000,182.000000) scale(0.100000,-0.100000)">
<path
d="M807 1810 c-46 -14 -94 -57 -116 -103 -16 -34 -21 -62 -21 -128 l0
-85 -57 54 c-131 122 -232 122 -350 1 -114 -118 -111 -221 11 -339 l57 -55
-101 -6 c-90 -5 -104 -8 -142 -35 -23 -16 -52 -49 -66 -74 -21 -40 -23 -55
-20 -140 4 -111 24 -154 90 -198 35 -22 53 -27 134 -30 l94 -4 -52 -57 c-116
-127 -118 -224 -5 -340 57 -58 115 -90 163 -91 70 0 97 13 169 82 l73 68 4
-99 c3 -86 7 -103 30 -138 15 -22 44 -51 65 -64 34 -21 50 -24 143 -24 93 0
109 3 143 24 21 13 50 41 65 63 23 35 27 53 30 135 l4 95 42 -40 c73 -69 111
-92 164 -99 70 -8 117 11 186 76 127 121 129 222 5 347 l-61 62 99 4 c89 3
102 6 142 33 62 42 85 91 89 192 5 107 -24 177 -90 219 -38 25 -55 29 -142 32
l-98 4 61 62 c122 124 122 224 0 343 -116 112 -205 112 -334 -2 l-63 -55 -4
94 c-3 81 -8 99 -30 134 -44 66 -87 86 -193 89 -49 1 -103 -2 -118 -7z m244
-599 c59 -30 121 -92 150 -149 21 -40 24 -61 24 -147 0 -85 -3 -107 -23 -145
-32 -61 -87 -116 -147 -148 -45 -24 -61 -27 -150 -27 -89 0 -105 3 -150 27
-60 32 -115 87 -147 148 -31 60 -37 186 -13 259 27 83 121 174 206 200 60 18
199 8 250 -18z"
/>
</g>
</svg>
</div>
);
};
export default SettingsIcon;