Skip to content

Commit

Permalink
Add click for non touch devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Mar 24, 2023
1 parent 75e0e4c commit aa33f88
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-quinoa.version>1.2.7</quarkus-quinoa.version>
<quarkus-quinoa.version>999-SNAPSHOT</quarkus-quinoa.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.16.4.Final</quarkus.platform.version>
Expand Down
11 changes: 9 additions & 2 deletions src/main/webui/src/components/GameController/Generator.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react';
import styled from 'styled-components';
import {
TAP_POWER, ENABLE_BLOWING, ENABLE_TAPPING, ENABLE_SWIPING,
TAP_POWER, ENABLE_BLOWING, ENABLE_TAPPING, ENABLE_SWIPING, IS_TOUCH_DEVICE,
} from '../../Config';
import { powerApi, sensors } from '../../api';
import Turbine from "./Turbine";
Expand Down Expand Up @@ -95,10 +95,17 @@ function Generator(props) {
}
};

const onClick = (e) => {
// Clicking
if (!IS_TOUCH_DEVICE && ENABLE_TAPPING) {
props.generatePower(TAP_POWER, true);
}
};

return (
<>
<GeneratorDiv generated={props.generated} color={props.color}>
<Turbine onTap={onTap} />
<Turbine onTap={onTap} onClick={onClick} />
</GeneratorDiv>
<GeneratedIndicatorDiv
unit={powerApi.humanPowerUnit(props.generated)}
Expand Down
1 change: 1 addition & 0 deletions src/main/webui/src/components/GameController/Turbine.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function Turbine(props) {
id="generator"
xmlns="http://www.w3.org/2000/svg"
onTouchStart={props.onTap}
onClick={props.onClick}
>
<g id="g409" transform="translate(-171,-10)">
<g transform="matrix(0.1,0,0,-0.1,0,511)" id="g407">
Expand Down

0 comments on commit aa33f88

Please sign in to comment.