gaesup-world 0.2.35 → 0.2.36
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.
- package/package.json +1 -1
- package/dist/gaesup/animation/actions.d.ts +0 -44
- package/dist/gaesup/animation/actions.js +0 -103
- package/dist/gaesup/camera/control/normal.d.ts +0 -4
- package/dist/gaesup/camera/control/normal.js +0 -18
- package/dist/gaesup/camera/control/orbit.d.ts +0 -4
- package/dist/gaesup/camera/control/orbit.js +0 -22
- package/dist/gaesup/camera/detector/index.d.ts +0 -2
- package/dist/gaesup/camera/detector/index.js +0 -25
- package/dist/gaesup/camera/index.d.ts +0 -8
- package/dist/gaesup/camera/index.js +0 -110
- package/dist/gaesup/camera/type.d.ts +0 -13
- package/dist/gaesup/camera/type.js +0 -1
- package/dist/gaesup/component/active/airplane/index.d.ts +0 -11
- package/dist/gaesup/component/active/airplane/index.js +0 -6
- package/dist/gaesup/component/active/character/index.d.ts +0 -7
- package/dist/gaesup/component/active/character/index.js +0 -34
- package/dist/gaesup/component/active/vehicle/index.d.ts +0 -12
- package/dist/gaesup/component/active/vehicle/index.js +0 -31
- package/dist/gaesup/component/index.d.ts +0 -7
- package/dist/gaesup/component/index.js +0 -19
- package/dist/gaesup/component/inner/airplane/index.d.ts +0 -2
- package/dist/gaesup/component/inner/airplane/index.js +0 -16
- package/dist/gaesup/component/inner/character/index.d.ts +0 -25
- package/dist/gaesup/component/inner/character/index.js +0 -28
- package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +0 -10
- package/dist/gaesup/component/inner/common/InnerGroupRef.js +0 -29
- package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +0 -4
- package/dist/gaesup/component/inner/common/OuterGroupRef.js +0 -6
- package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +0 -12
- package/dist/gaesup/component/inner/common/RigidbodyRef.js +0 -7
- package/dist/gaesup/component/inner/common/setGroundRay.d.ts +0 -9
- package/dist/gaesup/component/inner/common/setGroundRay.js +0 -14
- package/dist/gaesup/component/inner/common/type.d.ts +0 -20
- package/dist/gaesup/component/inner/common/type.js +0 -1
- package/dist/gaesup/component/inner/rider/index.d.ts +0 -11
- package/dist/gaesup/component/inner/rider/index.js +0 -31
- package/dist/gaesup/component/inner/vehicle/collider.d.ts +0 -10
- package/dist/gaesup/component/inner/vehicle/collider.js +0 -19
- package/dist/gaesup/component/inner/vehicle/index.d.ts +0 -2
- package/dist/gaesup/component/inner/vehicle/index.js +0 -17
- package/dist/gaesup/component/inner/vehicle/wheels.d.ts +0 -7
- package/dist/gaesup/component/inner/vehicle/wheels.js +0 -64
- package/dist/gaesup/component/passive/airplane/index.d.ts +0 -13
- package/dist/gaesup/component/passive/airplane/index.js +0 -40
- package/dist/gaesup/component/passive/character/index.d.ts +0 -10
- package/dist/gaesup/component/passive/character/index.js +0 -46
- package/dist/gaesup/component/passive/type.d.ts +0 -20
- package/dist/gaesup/component/passive/type.js +0 -1
- package/dist/gaesup/component/passive/vehicle/index.d.ts +0 -13
- package/dist/gaesup/component/passive/vehicle/index.js +0 -17
- package/dist/gaesup/component/type.d.ts +0 -17
- package/dist/gaesup/component/type.js +0 -1
- package/dist/gaesup/controller/context/index.d.ts +0 -49
- package/dist/gaesup/controller/context/index.js +0 -59
- package/dist/gaesup/controller/context/reducer.d.ts +0 -12
- package/dist/gaesup/controller/context/reducer.js +0 -21
- package/dist/gaesup/controller/context/type.d.ts +0 -38
- package/dist/gaesup/controller/context/type.js +0 -1
- package/dist/gaesup/controller/debug/airplane.d.ts +0 -71
- package/dist/gaesup/controller/debug/airplane.js +0 -71
- package/dist/gaesup/controller/debug/character.d.ts +0 -27
- package/dist/gaesup/controller/debug/character.js +0 -27
- package/dist/gaesup/controller/debug/index.d.ts +0 -6
- package/dist/gaesup/controller/debug/index.js +0 -49
- package/dist/gaesup/controller/debug/vehicle.d.ts +0 -27
- package/dist/gaesup/controller/debug/vehicle.js +0 -27
- package/dist/gaesup/controller/index.d.ts +0 -3
- package/dist/gaesup/controller/index.js +0 -75
- package/dist/gaesup/controller/initialize/callback/index.d.ts +0 -2
- package/dist/gaesup/controller/initialize/callback/index.js +0 -62
- package/dist/gaesup/controller/initialize/callback/type.d.ts +0 -27
- package/dist/gaesup/controller/initialize/callback/type.js +0 -1
- package/dist/gaesup/controller/initialize/index.d.ts +0 -10
- package/dist/gaesup/controller/initialize/index.js +0 -75
- package/dist/gaesup/controller/style.css +0 -48
- package/dist/gaesup/controller/type.d.ts +0 -85
- package/dist/gaesup/controller/type.js +0 -1
- package/dist/gaesup/gaesupProps/index.d.ts +0 -7
- package/dist/gaesup/gaesupProps/index.js +0 -46
- package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +0 -10
- package/dist/gaesup/hooks/useGaesupAnimation/index.js +0 -95
- package/dist/gaesup/hooks/useGaesupController/index.d.ts +0 -10
- package/dist/gaesup/hooks/useGaesupController/index.js +0 -14
- package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +0 -25
- package/dist/gaesup/hooks/useGaesupGltf/index.js +0 -73
- package/dist/gaesup/hooks/useJoyStick/index.d.ts +0 -39
- package/dist/gaesup/hooks/useJoyStick/index.js +0 -61
- package/dist/gaesup/hooks/usePushKey/index.d.ts +0 -3
- package/dist/gaesup/hooks/usePushKey/index.js +0 -29
- package/dist/gaesup/hooks/useRideable/index.d.ts +0 -28
- package/dist/gaesup/hooks/useRideable/index.js +0 -199
- package/dist/gaesup/hooks/useTeleport/index.d.ts +0 -3
- package/dist/gaesup/hooks/useTeleport/index.js +0 -12
- package/dist/gaesup/physics/airplane/damping.d.ts +0 -2
- package/dist/gaesup/physics/airplane/damping.js +0 -5
- package/dist/gaesup/physics/airplane/direction.d.ts +0 -2
- package/dist/gaesup/physics/airplane/direction.js +0 -65
- package/dist/gaesup/physics/airplane/gravity.d.ts +0 -14
- package/dist/gaesup/physics/airplane/gravity.js +0 -18
- package/dist/gaesup/physics/airplane/impulse.d.ts +0 -16
- package/dist/gaesup/physics/airplane/impulse.js +0 -31
- package/dist/gaesup/physics/airplane/index.d.ts +0 -2
- package/dist/gaesup/physics/airplane/index.js +0 -14
- package/dist/gaesup/physics/airplane/innerCalc.d.ts +0 -2
- package/dist/gaesup/physics/airplane/innerCalc.js +0 -27
- package/dist/gaesup/physics/airplane/landing.d.ts +0 -2
- package/dist/gaesup/physics/airplane/landing.js +0 -29
- package/dist/gaesup/physics/character/direction.d.ts +0 -23
- package/dist/gaesup/physics/character/direction.js +0 -55
- package/dist/gaesup/physics/character/impulse.d.ts +0 -2
- package/dist/gaesup/physics/character/impulse.js +0 -43
- package/dist/gaesup/physics/character/index.d.ts +0 -2
- package/dist/gaesup/physics/character/index.js +0 -8
- package/dist/gaesup/physics/character/innerCalc.d.ts +0 -2
- package/dist/gaesup/physics/character/innerCalc.js +0 -31
- package/dist/gaesup/physics/check/ground.d.ts +0 -2
- package/dist/gaesup/physics/check/ground.js +0 -15
- package/dist/gaesup/physics/check/index.d.ts +0 -2
- package/dist/gaesup/physics/check/index.js +0 -12
- package/dist/gaesup/physics/check/moving.d.ts +0 -2
- package/dist/gaesup/physics/check/moving.js +0 -16
- package/dist/gaesup/physics/check/push.d.ts +0 -2
- package/dist/gaesup/physics/check/push.js +0 -6
- package/dist/gaesup/physics/check/riding.d.ts +0 -2
- package/dist/gaesup/physics/check/riding.js +0 -7
- package/dist/gaesup/physics/check/rotate.d.ts +0 -2
- package/dist/gaesup/physics/check/rotate.js +0 -8
- package/dist/gaesup/physics/index.d.ts +0 -2
- package/dist/gaesup/physics/index.js +0 -58
- package/dist/gaesup/physics/type.d.ts +0 -36
- package/dist/gaesup/physics/type.js +0 -1
- package/dist/gaesup/physics/vehicle/damping.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/damping.js +0 -6
- package/dist/gaesup/physics/vehicle/direction.d.ts +0 -4
- package/dist/gaesup/physics/vehicle/direction.js +0 -30
- package/dist/gaesup/physics/vehicle/impulse.d.ts +0 -16
- package/dist/gaesup/physics/vehicle/impulse.js +0 -40
- package/dist/gaesup/physics/vehicle/index.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/index.js +0 -12
- package/dist/gaesup/physics/vehicle/innerCalc.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/innerCalc.js +0 -24
- package/dist/gaesup/physics/vehicle/landing.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/landing.js +0 -29
- package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +0 -9
- package/dist/gaesup/tools/gameBoy/GameBoyButton.js +0 -16
- package/dist/gaesup/tools/gameBoy/index.d.ts +0 -8
- package/dist/gaesup/tools/gameBoy/index.js +0 -22
- package/dist/gaesup/tools/gameBoy/style.css +0 -92
- package/dist/gaesup/tools/gameBoy/type.d.ts +0 -4
- package/dist/gaesup/tools/gameBoy/type.js +0 -1
- package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +0 -8
- package/dist/gaesup/tools/gamePad/GamePadButton.js +0 -21
- package/dist/gaesup/tools/gamePad/index.d.ts +0 -6
- package/dist/gaesup/tools/gamePad/index.js +0 -32
- package/dist/gaesup/tools/gamePad/style.css +0 -62
- package/dist/gaesup/tools/gamePad/type.d.ts +0 -6
- package/dist/gaesup/tools/gamePad/type.js +0 -1
- package/dist/gaesup/tools/joyStick/index.d.ts +0 -6
- package/dist/gaesup/tools/joyStick/index.js +0 -169
- package/dist/gaesup/tools/joyStick/style.css +0 -38
- package/dist/gaesup/tools/joyStick/type.d.ts +0 -19
- package/dist/gaesup/tools/joyStick/type.js +0 -1
- package/dist/gaesup/tools/jumpPortal/index.d.ts +0 -16
- package/dist/gaesup/tools/jumpPortal/index.js +0 -18
- package/dist/gaesup/tools/jumpPortal/style.css +0 -16
- package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +0 -402
- package/dist/gaesup/tools/keyBoardToolTip/constant.js +0 -122
- package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -10
- package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -12
- package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +0 -3
- package/dist/gaesup/tools/keyBoardToolTip/index.js +0 -70
- package/dist/gaesup/tools/keyBoardToolTip/style.css +0 -24
- package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +0 -37
- package/dist/gaesup/tools/keyBoardToolTip/type.js +0 -1
- package/dist/gaesup/tools/miniMap/default.d.ts +0 -9
- package/dist/gaesup/tools/miniMap/default.js +0 -9
- package/dist/gaesup/tools/miniMap/index.d.ts +0 -3
- package/dist/gaesup/tools/miniMap/index.js +0 -72
- package/dist/gaesup/tools/miniMap/style.css +0 -228
- package/dist/gaesup/tools/miniMap/type.d.ts +0 -25
- package/dist/gaesup/tools/miniMap/type.js +0 -1
- package/dist/gaesup/tools/rideable/index.d.ts +0 -3
- package/dist/gaesup/tools/rideable/index.js +0 -79
- package/dist/gaesup/tools/rideable/style.css +0 -16
- package/dist/gaesup/tools/type.d.ts +0 -2
- package/dist/gaesup/tools/type.js +0 -1
- package/dist/gaesup/tools/zoomButton/index.d.ts +0 -18
- package/dist/gaesup/tools/zoomButton/index.js +0 -146
- package/dist/gaesup/tools/zoomButton/style.css +0 -16
- package/dist/gaesup/utils/context.d.ts +0 -2
- package/dist/gaesup/utils/context.js +0 -3
- package/dist/gaesup/utils/debug.d.ts +0 -29
- package/dist/gaesup/utils/debug.js +0 -36
- package/dist/gaesup/utils/index.d.ts +0 -3
- package/dist/gaesup/utils/index.js +0 -3
- package/dist/gaesup/utils/ray.d.ts +0 -7
- package/dist/gaesup/utils/ray.js +0 -6
- package/dist/gaesup/utils/ref.d.ts +0 -2
- package/dist/gaesup/utils/ref.js +0 -16
- package/dist/gaesup/utils/type.d.ts +0 -5
- package/dist/gaesup/utils/type.js +0 -1
- package/dist/gaesup/utils/vector.d.ts +0 -10
- package/dist/gaesup/utils/vector.js +0 -33
- package/dist/gaesup/world/context/index.d.ts +0 -6
- package/dist/gaesup/world/context/index.js +0 -117
- package/dist/gaesup/world/context/reducer.d.ts +0 -29
- package/dist/gaesup/world/context/reducer.js +0 -21
- package/dist/gaesup/world/context/type.d.ts +0 -169
- package/dist/gaesup/world/context/type.js +0 -1
- package/dist/gaesup/world/debug/cameraOption.d.ts +0 -47
- package/dist/gaesup/world/debug/cameraOption.js +0 -47
- package/dist/gaesup/world/debug/index.d.ts +0 -6
- package/dist/gaesup/world/debug/index.js +0 -32
- package/dist/gaesup/world/debug/mode.d.ts +0 -10
- package/dist/gaesup/world/debug/mode.js +0 -10
- package/dist/gaesup/world/index.d.ts +0 -3
- package/dist/gaesup/world/index.js +0 -10
- package/dist/gaesup/world/initalize/index.d.ts +0 -35
- package/dist/gaesup/world/initalize/index.js +0 -62
- package/dist/gaesup/world/style.css +0 -13
- package/dist/gaesup/world/type.d.ts +0 -19
- package/dist/gaesup/world/type.js +0 -1
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -23
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
.gamePad {
|
|
2
|
-
display: grid;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
grid-template-columns: repeat(3, 1fr);
|
|
6
|
-
grid-template-rows: repeat(3, 1fr);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.padButton {
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: center;
|
|
13
|
-
position: relative;
|
|
14
|
-
width: 5rem;
|
|
15
|
-
height: 5rem;
|
|
16
|
-
border-radius: 50%;
|
|
17
|
-
font-size: 1rem;
|
|
18
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
19
|
-
color: white;
|
|
20
|
-
box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.5);
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
transition: all 0.3s ease-in;
|
|
23
|
-
margin: 0.5rem;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.padButton:hover {
|
|
27
|
-
box-shadow: 0 0 1rem rgba(0, 0, 0, 0.5);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.padButton::after {
|
|
31
|
-
content: "";
|
|
32
|
-
position: absolute;
|
|
33
|
-
width: 4rem;
|
|
34
|
-
height: 4rem;
|
|
35
|
-
border-radius: 50%;
|
|
36
|
-
background: rgba(0, 0, 0, 0.2);
|
|
37
|
-
z-index: 100000;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/* padButton isClicked variant */
|
|
41
|
-
.padButton.isClicked {
|
|
42
|
-
background: radial-gradient(
|
|
43
|
-
circle at center,
|
|
44
|
-
rgba(245, 177, 97, 1) 0.4%,
|
|
45
|
-
rgba(236, 54, 110, 1) 100.2%
|
|
46
|
-
);
|
|
47
|
-
box-shadow: 0 0 1rem rgba(245, 177, 97, 1);
|
|
48
|
-
color: black;
|
|
49
|
-
transition: all 0.3s ease-in;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.padButton.isClicked:hover {
|
|
53
|
-
box-shadow: 0 0 2rem rgba(245, 177, 97, 1);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.gamePad * {
|
|
57
|
-
-webkit-touch-callout: none;
|
|
58
|
-
-webkit-user-select: none;
|
|
59
|
-
-moz-user-select: none;
|
|
60
|
-
-ms-user-select: none;
|
|
61
|
-
user-select: none;
|
|
62
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { useCallback, useContext, useEffect, useRef, useState, } from "react";
|
|
14
|
-
import useJoyStick from "../../hooks/useJoyStick";
|
|
15
|
-
import { GaesupWorldContext } from "../../world/context";
|
|
16
|
-
import "./style.css";
|
|
17
|
-
export function JoyStick(props) {
|
|
18
|
-
var outerRef = useRef(null);
|
|
19
|
-
var childRef = useRef(null);
|
|
20
|
-
var joyStickBallStyle = props.joyStickBallStyle, joyStickStyle = props.joyStickStyle;
|
|
21
|
-
var mode = useContext(GaesupWorldContext).mode;
|
|
22
|
-
var _a = useJoyStick(), joyStickBall = _a.joyStickBall, joyStickOrigin = _a.joyStickOrigin, setBall = _a.setBall, setOrigin = _a.setOrigin;
|
|
23
|
-
var _b = useState({
|
|
24
|
-
mouseDown: false,
|
|
25
|
-
touchDown: false,
|
|
26
|
-
position: "absolute",
|
|
27
|
-
transform: "",
|
|
28
|
-
background: "rgba(0, 0, 0, 0.5)",
|
|
29
|
-
boxShadow: "0 0 10px rgba(0, 0, 0, 0.5)",
|
|
30
|
-
}), state = _b[0], setState = _b[1];
|
|
31
|
-
var _c = useState({
|
|
32
|
-
top: 0,
|
|
33
|
-
left: 0,
|
|
34
|
-
bottom: 0,
|
|
35
|
-
right: 0,
|
|
36
|
-
width: 0,
|
|
37
|
-
height: 0,
|
|
38
|
-
}), screenSize = _c[0], setScreenSize = _c[1];
|
|
39
|
-
var initBall = function () {
|
|
40
|
-
setState(function (state) { return (__assign(__assign({}, state), { position: "absolute", transform: "translate(-50%, -50%)", background: "rgba(0, 0, 0, 0.5)", boxShadow: "0 0 10px rgba(0, 0, 0, 0.5)" })); });
|
|
41
|
-
setBall({
|
|
42
|
-
top: "50%",
|
|
43
|
-
left: "50%",
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var setMouseDown = function (value) {
|
|
47
|
-
setState(function (state) { return (__assign(__assign({}, state), { mouseDown: value })); });
|
|
48
|
-
};
|
|
49
|
-
var setTouchDown = function (value) {
|
|
50
|
-
setState(function (state) { return (__assign(__assign({}, state), { touchDown: value })); });
|
|
51
|
-
};
|
|
52
|
-
var initialize = function () {
|
|
53
|
-
var client = outerRef.current.getBoundingClientRect();
|
|
54
|
-
var x = client.left + client.width / 2;
|
|
55
|
-
var y = client.top + client.height / 2;
|
|
56
|
-
setScreenSize(function () { return ({
|
|
57
|
-
top: client.top,
|
|
58
|
-
left: client.left,
|
|
59
|
-
bottom: client.bottom,
|
|
60
|
-
right: client.right,
|
|
61
|
-
width: client.width,
|
|
62
|
-
height: client.height,
|
|
63
|
-
}); });
|
|
64
|
-
setOrigin({
|
|
65
|
-
x: x,
|
|
66
|
-
y: y,
|
|
67
|
-
angle: Math.PI / 2,
|
|
68
|
-
currentRadius: 0,
|
|
69
|
-
originRadius: 0,
|
|
70
|
-
isIn: true,
|
|
71
|
-
isOn: false,
|
|
72
|
-
isCenter: true,
|
|
73
|
-
isUp: true,
|
|
74
|
-
});
|
|
75
|
-
initBall();
|
|
76
|
-
};
|
|
77
|
-
var resize = function () {
|
|
78
|
-
if (!outerRef.current)
|
|
79
|
-
return;
|
|
80
|
-
var client = outerRef.current.getBoundingClientRect();
|
|
81
|
-
setScreenSize(function () { return ({
|
|
82
|
-
top: client.top,
|
|
83
|
-
left: client.left,
|
|
84
|
-
bottom: client.bottom,
|
|
85
|
-
right: client.right,
|
|
86
|
-
width: client.width,
|
|
87
|
-
height: client.height,
|
|
88
|
-
}); });
|
|
89
|
-
};
|
|
90
|
-
var calcOriginBall = function (X, Y) {
|
|
91
|
-
var top = screenSize.top, left = screenSize.left, bottom = screenSize.bottom, right = screenSize.right, width = screenSize.width, height = screenSize.height;
|
|
92
|
-
if (top > Y || bottom < Y || left > X || right < X) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
var dx = joyStickOrigin.x - X;
|
|
96
|
-
var dy = joyStickOrigin.y - Y;
|
|
97
|
-
var normX = Math.pow(dx, 2);
|
|
98
|
-
var normY = Math.pow(dy, 2);
|
|
99
|
-
var currentRadius = Math.sqrt(normX + normY);
|
|
100
|
-
var originRadius = Math.sqrt(Math.pow((width / 2), 2) + Math.pow((height / 2), 2));
|
|
101
|
-
var newAngle = Math.atan2(Y - (bottom - height / 2), X - (left + width / 2));
|
|
102
|
-
if (currentRadius >= width / 2) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
setOrigin({
|
|
106
|
-
x: left + width / 2,
|
|
107
|
-
y: bottom - height / 2,
|
|
108
|
-
angle: newAngle,
|
|
109
|
-
currentRadius: currentRadius,
|
|
110
|
-
originRadius: originRadius,
|
|
111
|
-
isIn: currentRadius > originRadius / 2,
|
|
112
|
-
isOn: true,
|
|
113
|
-
isCenter: currentRadius < originRadius / 8,
|
|
114
|
-
isUp: top > Y - height / 2,
|
|
115
|
-
});
|
|
116
|
-
setState(function (state) { return (__assign(__assign({}, state), { position: "fixed", background: currentRadius > originRadius / 2
|
|
117
|
-
? "linear-gradient( 68.4deg, rgba(176,255,237,1) -0.4%, rgba(161,244,255,1) 100.2% )"
|
|
118
|
-
: "linear-gradient( 68.4deg, rgba(99,251,215,1) -0.4%, rgba(5,222,250,1) 100.2% )", boxShadow: "0 0 10px rgba(99,251,215,1)" })); });
|
|
119
|
-
setBall({
|
|
120
|
-
top: "".concat(Y, "px"),
|
|
121
|
-
left: "".concat(X, "px"),
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
var handleMouseOver = function (e) {
|
|
125
|
-
if (!state.mouseDown)
|
|
126
|
-
return;
|
|
127
|
-
e.preventDefault();
|
|
128
|
-
calcOriginBall(e.clientX, e.clientY);
|
|
129
|
-
};
|
|
130
|
-
var handleTouchMove = function (e) {
|
|
131
|
-
if (!state.touchDown)
|
|
132
|
-
return;
|
|
133
|
-
calcOriginBall(e.touches[0].pageX, e.touches[0].pageY);
|
|
134
|
-
};
|
|
135
|
-
var handleTouchEnd = useCallback(function (e) {
|
|
136
|
-
setState(function (state) { return (__assign(__assign({}, state), { touchDown: false })); });
|
|
137
|
-
return initialize();
|
|
138
|
-
}, [setBall, setState, setOrigin, state.touchDown]);
|
|
139
|
-
var handleMouseOut = useCallback(function (e) {
|
|
140
|
-
setState(function (state) { return (__assign(__assign({}, state), { mouseDown: false })); });
|
|
141
|
-
e.preventDefault();
|
|
142
|
-
return initialize();
|
|
143
|
-
}, [setBall, setState, setOrigin, state.mouseDown]);
|
|
144
|
-
useEffect(function () {
|
|
145
|
-
window.addEventListener("resize", resize);
|
|
146
|
-
}, []);
|
|
147
|
-
useEffect(function () {
|
|
148
|
-
if (outerRef.current) {
|
|
149
|
-
initialize();
|
|
150
|
-
}
|
|
151
|
-
}, [mode.controller]);
|
|
152
|
-
return (_jsx(_Fragment, { children: mode.controller === "joystick" && (_jsx("div", { className: "joyStick", style: __assign({ position: "fixed" }, joyStickStyle), ref: outerRef, onMouseDown: function (e) {
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
setMouseDown(true);
|
|
155
|
-
}, onMouseUp: function (e) {
|
|
156
|
-
e.preventDefault();
|
|
157
|
-
setMouseDown(false);
|
|
158
|
-
}, onMouseMove: handleMouseOver, onMouseLeave: handleMouseOut, onTouchStart: function (e) {
|
|
159
|
-
setTouchDown(true);
|
|
160
|
-
}, onTouchEnd: handleTouchEnd, onTouchMove: handleTouchMove, onTouchCancel: handleTouchEnd, children: _jsx("div", { className: "joystickBall", ref: childRef, onMouseDown: function (e) {
|
|
161
|
-
e.preventDefault();
|
|
162
|
-
setMouseDown(true);
|
|
163
|
-
}, onMouseUp: function (e) {
|
|
164
|
-
e.preventDefault();
|
|
165
|
-
setMouseDown(false);
|
|
166
|
-
}, onMouseMove: handleMouseOver, onMouseLeave: handleMouseOut, onTouchStart: function (e) {
|
|
167
|
-
setTouchDown(true);
|
|
168
|
-
}, onTouchEnd: handleTouchEnd, onTouchMove: handleTouchMove, onTouchCancel: handleTouchEnd, style: __assign({ position: state.position, transform: state.transform, background: (joyStickBallStyle === null || joyStickBallStyle === void 0 ? void 0 : joyStickBallStyle.background) || state.background, boxShadow: (joyStickBallStyle === null || joyStickBallStyle === void 0 ? void 0 : joyStickBallStyle.boxShadow) || state.boxShadow, top: joyStickBall.top, left: joyStickBall.left }, joyStickBallStyle) }) })) }));
|
|
169
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
.joyStick {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
text-align: center;
|
|
6
|
-
width: 12rem;
|
|
7
|
-
height: 12rem;
|
|
8
|
-
overflow: auto;
|
|
9
|
-
border-radius: 50%;
|
|
10
|
-
background: rgba(0, 0, 0, 0.5);
|
|
11
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* .joyStick::after {
|
|
15
|
-
content: "";
|
|
16
|
-
width: 10rem;
|
|
17
|
-
height: 10rem;
|
|
18
|
-
border-radius: 50%;
|
|
19
|
-
background: rgba(0, 0, 0, 0.2);
|
|
20
|
-
} */
|
|
21
|
-
|
|
22
|
-
.joystickBall {
|
|
23
|
-
width: 5rem;
|
|
24
|
-
height: 5rem;
|
|
25
|
-
transform: translate(-50%, -50%);
|
|
26
|
-
border-radius: 50%;
|
|
27
|
-
background: rgba(0, 0, 0, 0.5);
|
|
28
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.joyStick * {
|
|
33
|
-
-webkit-touch-callout: none;
|
|
34
|
-
-webkit-user-select: none;
|
|
35
|
-
-moz-user-select: none;
|
|
36
|
-
-ms-user-select: none;
|
|
37
|
-
user-select: none;
|
|
38
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type joyStickBallType = {
|
|
2
|
-
left: string;
|
|
3
|
-
top: string;
|
|
4
|
-
};
|
|
5
|
-
export type joyStickOriginType = {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
angle: number;
|
|
9
|
-
currentRadius: number;
|
|
10
|
-
originRadius: number;
|
|
11
|
-
isIn: boolean;
|
|
12
|
-
isOn: boolean;
|
|
13
|
-
isUp: boolean;
|
|
14
|
-
isCenter: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type joyStickInnerType = {
|
|
17
|
-
joyStickBall?: joyStickBallType;
|
|
18
|
-
joyStickOrigin?: joyStickOriginType;
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from "react";
|
|
2
|
-
import "./style.css";
|
|
3
|
-
export type JumpPortalType = {
|
|
4
|
-
text?: string;
|
|
5
|
-
position: THREE.Vector3;
|
|
6
|
-
jumpPortalStyle?: CSSProperties;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* JumpPortal component represents a clickable portal that teleports the user to a specified location.
|
|
10
|
-
*
|
|
11
|
-
* @param {JumpPortalType} props - The props for the JumpPortal component.
|
|
12
|
-
* @param {string} props.text - (Optional) The text to display on the portal.
|
|
13
|
-
* @param {THREE.Vector3} props.position - The target position to teleport to.
|
|
14
|
-
* @param {CSSProperties} props.jumpPortalStyle - (Optional) CSS styles for the JumpPortal component.
|
|
15
|
-
*/
|
|
16
|
-
export declare function JumpPortal({ text, position, jumpPortalStyle, }: JumpPortalType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTeleport } from "../../hooks/useTeleport";
|
|
3
|
-
import "./style.css";
|
|
4
|
-
/**
|
|
5
|
-
* JumpPortal component represents a clickable portal that teleports the user to a specified location.
|
|
6
|
-
*
|
|
7
|
-
* @param {JumpPortalType} props - The props for the JumpPortal component.
|
|
8
|
-
* @param {string} props.text - (Optional) The text to display on the portal.
|
|
9
|
-
* @param {THREE.Vector3} props.position - The target position to teleport to.
|
|
10
|
-
* @param {CSSProperties} props.jumpPortalStyle - (Optional) CSS styles for the JumpPortal component.
|
|
11
|
-
*/
|
|
12
|
-
export function JumpPortal(_a) {
|
|
13
|
-
var text = _a.text, position = _a.position, jumpPortalStyle = _a.jumpPortalStyle;
|
|
14
|
-
var Teleport = useTeleport().Teleport;
|
|
15
|
-
return (_jsx("div", { className: "jumpPortal", onClick: function () {
|
|
16
|
-
Teleport(position);
|
|
17
|
-
}, style: jumpPortalStyle, children: text }));
|
|
18
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.jumpPortal {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
text-align: center;
|
|
6
|
-
margin: 1rem;
|
|
7
|
-
font-size: 0.8rem;
|
|
8
|
-
border-radius: 50%;
|
|
9
|
-
width: 5rem;
|
|
10
|
-
height: 5rem;
|
|
11
|
-
color: white;
|
|
12
|
-
background: rgba(0, 0, 0, 0.6);
|
|
13
|
-
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.6);
|
|
14
|
-
transition: all 0.2s ease-in;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
}
|