|
1 | | -import {useState} from "react"; |
| 1 | +import { useState } from "react"; |
2 | 2 |
|
3 | 3 | export function EventApp() { |
4 | 4 | const [clickCount, setClickCount] = useState(0); |
5 | 5 | const [mouseState, setMouseState] = useState("idle"); |
6 | | - const [mousePos, setMousePos] = useState({x: 0, y: 0}); |
| 6 | + const [mousePos, setMousePos] = useState({ x: 0, y: 0 }); |
7 | 7 | const [lastKey, setLastKey] = useState(""); |
8 | | - const [scrollDelta, setScrollDelta] = useState({x: 0, y: 0}); |
| 8 | + const [scrollDelta, setScrollDelta] = useState({ x: 0, y: 0 }); |
9 | 9 |
|
10 | 10 | return ( |
11 | 11 | <div |
@@ -63,7 +63,9 @@ export function EventApp() { |
63 | 63 | }} |
64 | 64 | onMouseDown={() => setMouseState("down")} |
65 | 65 | onMouseUp={() => setMouseState("up")} |
66 | | - onMouseMove={(e) => setMousePos({x: Math.round(e.clientX), y: Math.round(e.clientY)})} |
| 66 | + onMouseMove={(e) => |
| 67 | + setMousePos({ x: Math.round(e.clientX), y: Math.round(e.clientY) }) |
| 68 | + } |
67 | 69 | > |
68 | 70 | <div>{"Mouse: " + mouseState}</div> |
69 | 71 | <div>{"Position: " + mousePos.x + ", " + mousePos.y}</div> |
@@ -101,7 +103,9 @@ export function EventApp() { |
101 | 103 | alignItems: "center", |
102 | 104 | justifyContent: "center", |
103 | 105 | }} |
104 | | - onWheel={(e) => setScrollDelta({x: Math.round(e.deltaX), y: Math.round(e.deltaY)})} |
| 106 | + onWheel={(e) => |
| 107 | + setScrollDelta({ x: Math.round(e.deltaX), y: Math.round(e.deltaY) }) |
| 108 | + } |
105 | 109 | > |
106 | 110 | {"Wheel: " + scrollDelta.x + ", " + scrollDelta.y} |
107 | 111 | </div> |
|
0 commit comments