Disable multitouch
This commit is contained in:
parent
535cff8612
commit
e9a55080bd
@ -11,7 +11,14 @@ const Client = () => {
|
|||||||
const [buttonMap, setButtonMap] = useState<ButtonMap>(defaultButtonMap);
|
const [buttonMap, setButtonMap] = useState<ButtonMap>(defaultButtonMap);
|
||||||
|
|
||||||
const updateButtonEvent = (button: ButtonType, state: "down" | "up") =>
|
const updateButtonEvent = (button: ButtonType, state: "down" | "up") =>
|
||||||
() => setButtonMap((m) => ({ ...m, [button]: (state === "down") }));
|
() => setButtonMap((m) => {
|
||||||
|
const newMap = { ...m, [button]: (state === "down") };
|
||||||
|
if (mapToBitvector(newMap).reduce((a,b) => a+b, 0) > 1) {
|
||||||
|
return m;
|
||||||
|
} else {
|
||||||
|
return newMap;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Send data to server
|
// Send data to server
|
||||||
|
@ -27,7 +27,7 @@ const TVMode = () => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const totalCount = useMemo(() => buttonTypeList.reduce((acc, v) => (state?.votes?.[v] ?? 0) + acc, 0), [state]);
|
const totalCount = useMemo(() => buttonTypeList.reduce((acc, v) => (state?.votes?.[v] ?? 0) + acc, 0), [state]);
|
||||||
const voteList = useMemo(() => buttonTypeList.map(b => [b, state?.votes?.[b] ?? 0] as [ButtonType, number]).sort((a, b) => a[1] < b[1] ? -1 : 1), [state]);
|
const voteList = useMemo(() => buttonTypeList.map(b => [b, state?.votes?.[b] ?? 0] as [ButtonType, number]).sort((a, b) => b[1] - a[1]), [state]);
|
||||||
|
|
||||||
return <div className="stream">
|
return <div className="stream">
|
||||||
{state === undefined ?
|
{state === undefined ?
|
||||||
@ -40,7 +40,11 @@ const TVMode = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="voting">
|
<div className="voting">
|
||||||
{voteList.flatMap(([b, numVotes], index) => numVotes === 0
|
{voteList.flatMap(([b, numVotes], index) => numVotes === 0
|
||||||
? []
|
? [
|
||||||
|
<div className="vote" key={index}>
|
||||||
|
<span>{b}</span><span></span>
|
||||||
|
</div>
|
||||||
|
]
|
||||||
: [
|
: [
|
||||||
<div className="vote" key={index}>
|
<div className="vote" key={index}>
|
||||||
<span>{b}</span><span> {Math.round(numVotes / totalCount * 100) + "%"} </span>
|
<span>{b}</span><span> {Math.round(numVotes / totalCount * 100) + "%"} </span>
|
||||||
|
Loading…
Reference in New Issue
Block a user