gaesup-world 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,52 +18,10 @@ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/contex
|
|
|
18
18
|
export function GaeSupProps(_a) {
|
|
19
19
|
var _b = _a.type, type = _b === void 0 ? "normal" : _b, text = _a.text, position = _a.position, children = _a.children;
|
|
20
20
|
var groupRef = useRef(null);
|
|
21
|
-
var
|
|
21
|
+
var minimap = useContext(GaesupWorldContext).minimap;
|
|
22
22
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
23
23
|
// clicker
|
|
24
24
|
var moveClicker = useClicker().moveClicker;
|
|
25
|
-
// const moveClicker = (e: ThreeEvent<MouseEvent>) => {
|
|
26
|
-
// const originPoint = activeState.position;
|
|
27
|
-
// const newPosition = e.point;
|
|
28
|
-
// const newAngle = Math.atan2(
|
|
29
|
-
// newPosition.z - originPoint.z,
|
|
30
|
-
// newPosition.x - originPoint.x
|
|
31
|
-
// );
|
|
32
|
-
// const norm = Math.sqrt(
|
|
33
|
-
// Math.pow(newPosition.z - originPoint.z, 2) +
|
|
34
|
-
// Math.pow(newPosition.x - originPoint.x, 2)
|
|
35
|
-
// );
|
|
36
|
-
// if (norm < 1) return;
|
|
37
|
-
// dispatch({
|
|
38
|
-
// type: "update",
|
|
39
|
-
// payload: {
|
|
40
|
-
// clicker: {
|
|
41
|
-
// point: V3(e.point.x, e.point.y, e.point.z),
|
|
42
|
-
// angle: newAngle,
|
|
43
|
-
// isOn: true,
|
|
44
|
-
// },
|
|
45
|
-
// },
|
|
46
|
-
// });
|
|
47
|
-
// };
|
|
48
|
-
//
|
|
49
|
-
// // 거리 계산
|
|
50
|
-
// useEffect(() => {
|
|
51
|
-
// const originPoint = activeState.position;
|
|
52
|
-
// const newPosition = clicker.point;
|
|
53
|
-
// const norm = Math.sqrt(
|
|
54
|
-
// Math.pow(newPosition.z - originPoint.z, 2) +
|
|
55
|
-
// Math.pow(newPosition.x - originPoint.x, 2)
|
|
56
|
-
// );
|
|
57
|
-
// if (norm < 1) {
|
|
58
|
-
// clicker.isOn = false;
|
|
59
|
-
// dispatch({
|
|
60
|
-
// type: "update",
|
|
61
|
-
// payload: {
|
|
62
|
-
// clicker: clicker,
|
|
63
|
-
// },
|
|
64
|
-
// });
|
|
65
|
-
// }
|
|
66
|
-
// }, [activeState.position, clicker.point]);
|
|
67
25
|
useEffect(function () {
|
|
68
26
|
if (groupRef.current) {
|
|
69
27
|
var box = new THREE.Box3().setFromObject(groupRef.current);
|
|
@@ -84,7 +42,5 @@ export function GaeSupProps(_a) {
|
|
|
84
42
|
});
|
|
85
43
|
}
|
|
86
44
|
}, []);
|
|
87
|
-
return (_jsx(Suspense, { fallback: null, children: _jsx("group", { ref: groupRef, position: position,
|
|
88
|
-
// onClick={(e) => clickerPoint(e, activeState.position.clone())}
|
|
89
|
-
onPointerDown: function (e) { return moveClicker(e, false); }, onDoubleClick: function (e) { return moveClicker(e, true); }, children: children }) }));
|
|
45
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx("group", { ref: groupRef, position: position, onPointerDown: function (e) { return moveClicker(e, false, type); }, onDoubleClick: function (e) { return moveClicker(e, true, type); }, children: children }) }));
|
|
90
46
|
}
|
|
@@ -4,8 +4,8 @@ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/con
|
|
|
4
4
|
export default function useClicker() {
|
|
5
5
|
var _a = useContext(GaesupWorldContext), activeState = _a.activeState, clicker = _a.clicker, mode = _a.mode;
|
|
6
6
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
7
|
-
var moveClicker = function (e, isRun) {
|
|
8
|
-
if (mode.controller !== "clicker")
|
|
7
|
+
var moveClicker = function (e, isRun, type) {
|
|
8
|
+
if (mode.controller !== "clicker" || type !== "ground")
|
|
9
9
|
return;
|
|
10
10
|
var originPoint = activeState.position;
|
|
11
11
|
var newPosition = e.point;
|