gaesup-world 0.8.2 → 0.8.12

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.
@@ -38,12 +38,6 @@ export declare const gaesupControllerDefault: {
38
38
  innerGroupRef: any;
39
39
  characterInnerRef: any;
40
40
  };
41
- controllerOptions: {
42
- lerp: {
43
- cameraTurn: number;
44
- cameraPosition: number;
45
- };
46
- };
47
41
  };
48
42
  export declare const GaesupControllerContext: import("react").Context<gaesupControllerType>;
49
43
  export declare const GaesupControllerDispatchContext: import("react").Context<dispatchType<gaesupControllerType>>;
@@ -48,12 +48,6 @@ export var gaesupControllerDefault = {
48
48
  innerGroupRef: null,
49
49
  characterInnerRef: null,
50
50
  },
51
- controllerOptions: {
52
- lerp: {
53
- cameraTurn: 1,
54
- cameraPosition: 1,
55
- },
56
- },
57
51
  };
58
52
  export var GaesupControllerContext = createContext(__assign({}, gaesupControllerDefault));
59
53
  export var GaesupControllerDispatchContext = createContext(null);
@@ -6,7 +6,6 @@ export declare function gaesupControllerReducer(props: gaesupControllerType, act
6
6
  airplane: import("./type").airplaneType;
7
7
  vehicle: import("./type").vehicleType;
8
8
  character: import("./type").characterType;
9
- controllerOptions: import("../type").controllerOptionsType;
10
9
  callbacks?: import("../initialize/callback/type").callbackType;
11
10
  refs?: import("../type").refsType;
12
11
  };
@@ -47,7 +47,6 @@ export function GaesupControllerInner(props) {
47
47
  innerGroupRef: innerGroupRef,
48
48
  characterInnerRef: characterInnerRef,
49
49
  },
50
- controllerOptions: Object.assign(gaesupControllerDefault.controllerOptions, props.controllerOptions || {}),
51
50
  }), controller = _a[0], controllerDispatch = _a[1];
52
51
  var gaesupControl = useMemo(function () { return ({
53
52
  value: controller,
@@ -65,7 +64,7 @@ export function GaesupControllerInner(props) {
65
64
  }, []);
66
65
  var prop = __assign(__assign(__assign(__assign({}, initControllerProps({
67
66
  refs: refs,
68
- })), { children: props.children, groupProps: props.groupProps, controllerOptions: gaesupControl.value.controllerOptions }), gaesupControl.value.callbacks), refs);
67
+ })), { children: props.children, groupProps: props.groupProps }), gaesupControl.value.callbacks), refs);
69
68
  initDebug({
70
69
  controllerContext: gaesupControl.value,
71
70
  controllerDispatch: gaesupControl.dispatch,
@@ -1,10 +1,16 @@
1
1
  import { groundRayType, refsType } from "../../controller/type";
2
2
  import { cameraRayType } from "../../camera/type";
3
3
  import { keyControlType } from "../../world/context/type";
4
- export default function initControllerProps(props: {
4
+ export default function initControllerProps({ refs }: {
5
5
  refs: refsType;
6
6
  }): {
7
7
  groundRay: groundRayType;
8
8
  cameraRay: cameraRayType;
9
9
  keyControl: keyControlType;
10
+ controllerOptions: {
11
+ lerp: {
12
+ cameraPosition: number;
13
+ cameraTurn: number;
14
+ };
15
+ };
10
16
  };
@@ -15,10 +15,11 @@ import { useCallback, useContext, useEffect, useMemo } from "react";
15
15
  import * as THREE from "three";
16
16
  import { update } from "../../utils/context";
17
17
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
18
- export default function initControllerProps(props) {
18
+ export default function initControllerProps(_a) {
19
+ var refs = _a.refs;
19
20
  var context = useContext(GaesupWorldContext);
20
21
  var dispatch = useContext(GaesupWorldDispatchContext);
21
- var _a = useKeyboardControls(), _ = _a[0], getKeys = _a[1];
22
+ var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
22
23
  var keyControl = getKeys();
23
24
  useEffect(function () {
24
25
  if (context && keyControl && context.control) {
@@ -70,19 +71,28 @@ export default function initControllerProps(props) {
70
71
  intersectObjectMap: {},
71
72
  };
72
73
  }, []);
74
+ var controllerOptions = useMemo(function () {
75
+ return {
76
+ lerp: {
77
+ cameraPosition: 0.9,
78
+ cameraTurn: 0.1,
79
+ },
80
+ };
81
+ }, []);
73
82
  var initRefs = useCallback(function (refs) {
74
83
  update({
75
84
  refs: __assign({}, refs),
76
85
  }, dispatch);
77
- }, [props.refs]);
86
+ }, [refs]);
78
87
  useEffect(function () {
79
- if (props.refs) {
80
- initRefs(props.refs);
88
+ if (refs) {
89
+ initRefs(refs);
81
90
  }
82
91
  }, []);
83
92
  return {
84
93
  groundRay: groundRay,
85
94
  cameraRay: cameraRay,
86
95
  keyControl: keyControl,
96
+ controllerOptions: controllerOptions,
87
97
  };
88
98
  }
@@ -81,7 +81,6 @@ export type gaesupControllerContextPropType = {
81
81
  airplane: airplaneType;
82
82
  vehicle: vehicleType;
83
83
  character: characterType;
84
- controllerOptions: controllerOptionsType;
85
84
  };
86
85
  export interface controllerOtherPropType extends RigidBodyProps {
87
86
  children?: ReactNode;
@@ -89,6 +88,4 @@ export interface controllerOtherPropType extends RigidBodyProps {
89
88
  rigidBodyProps?: RigidBodyProps;
90
89
  debug?: boolean;
91
90
  }
92
- export type controllerType = controllerOtherPropType & urlsType & Partial<gaesupControllerContextPropType> & callbackType & {
93
- controllerOptions?: controllerOptionsType;
94
- };
91
+ export type controllerType = controllerOtherPropType & urlsType & Partial<gaesupControllerContextPropType> & callbackType;
@@ -1,5 +1,5 @@
1
1
  export default function moving(prop) {
2
- var _a = prop.worldContext, states = _a.states, joystick = _a.joystick, mode = _a.mode, control = _a.control, clicker = _a.clicker, clickerOption = _a.clickerOption;
2
+ var _a = prop.worldContext, states = _a.states, joystick = _a.joystick, mode = _a.mode, control = _a.control, clicker = _a.clicker;
3
3
  var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward, shift = control.shift, space = control.space;
4
4
  if (mode.controller === "gameboy" || mode.controller === "keyboard") {
5
5
  states.isMoving = forward || backward || leftward || rightward;
@@ -16,8 +16,7 @@ export default function moving(prop) {
16
16
  else if (mode.controller === "clicker") {
17
17
  states.isMoving = clicker.isOn;
18
18
  states.isNotMoving = !clicker.isOn;
19
- states.isRunning =
20
- (shift || clicker.isRun) && states.isMoving && clickerOption.isRun;
19
+ states.isRunning = (shift || clicker.isRun) && states.isMoving;
21
20
  states.isJumping = space;
22
21
  }
23
22
  }
@@ -3,6 +3,6 @@ import { useContext } from "react";
3
3
  import { GaesupWorldContext } from "../../world/context";
4
4
  export function Clicker(_a) {
5
5
  var onMarker = _a.onMarker, runMarker = _a.runMarker;
6
- var _b = useContext(GaesupWorldContext), clicker = _b.clicker, mode = _b.mode, clickerOption = _b.clickerOption;
7
- return (_jsx(_Fragment, { children: mode.controller === "clicker" && (_jsxs("group", { position: clicker.point, children: [clicker.isOn && onMarker, clicker.isOn && clickerOption.isRun && clicker.isRun && runMarker] })) }));
6
+ var _b = useContext(GaesupWorldContext), clicker = _b.clicker, mode = _b.mode;
7
+ return (_jsx(_Fragment, { children: mode.controller === "clicker" && (_jsxs("group", { position: clicker.point, children: [clicker.isOn && onMarker, clicker.isOn && clicker.isRun && runMarker] })) }));
8
8
  }
@@ -19,7 +19,7 @@ import "./style.css";
19
19
  export function MiniMap(props) {
20
20
  var _a = useContext(GaesupWorldContext), minimap = _a.minimap, activeState = _a.activeState, mode = _a.mode;
21
21
  var _b = useState(props.scale || minimapDefault.scale), scale = _b[0], setscale = _b[1];
22
- var minimapInnerStyle = props.minimapInnerStyle, textStyle = props.textStyle, minimapObjectStyle = props.minimapObjectStyle, avatarStyle = props.avatarStyle, scaleStyle = props.scaleStyle, directionStyle = props.directionStyle, plusMinusStyle = props.plusMinusStyle, imageStyle = props.imageStyle, minimapStyle = props.minimapStyle, minimapOuterStyle = props.minimapOuterStyle;
22
+ var innerStyle = props.innerStyle, textStyle = props.textStyle, objectStyle = props.objectStyle, avatarStyle = props.avatarStyle, scaleStyle = props.scaleStyle, directionStyle = props.directionStyle, plusMinusStyle = props.plusMinusStyle, imageStyle = props.imageStyle;
23
23
  var upscale = useCallback(function () {
24
24
  var max = props.maxScale || minimapDefault.maxScale;
25
25
  setscale(function (scale) { return Math.min(max, scale + 0.1); });
@@ -35,9 +35,9 @@ export function MiniMap(props) {
35
35
  upscale();
36
36
  else
37
37
  downscale();
38
- }, style: minimapStyle, children: [_jsx("div", { className: "minimapOuter", style: minimapOuterStyle }), _jsxs("div", { className: "minimapInner", style: __assign({ transform: props.blockRotate || mode.control === "normal"
38
+ }, children: [_jsx("div", { className: "minimapOuter", style: objectStyle }), _jsxs("div", { className: "minimapInner", style: __assign({ transform: props.blockRotate || mode.control === "normal"
39
39
  ? "translate(-50%, -50%) rotate(180deg) "
40
- : "translate(-50%, -50%) rotate(".concat((activeState.euler.y * 180) / Math.PI + 180, "deg) ") }, minimapInnerStyle), children: [_jsx("div", { className: "east direction", style: __assign({ transform: props.blockRotate || mode.control === "normal"
40
+ : "translate(-50%, -50%) rotate(".concat((activeState.euler.y * 180) / Math.PI + 180, "deg) ") }, innerStyle), children: [" ", _jsx("div", { className: "east direction", style: __assign({ transform: props.blockRotate || mode.control === "normal"
41
41
  ? "translate(-50%, -50%) rotate(180deg) "
42
42
  : "translate(-50%, -50%) rotate(-".concat((activeState.euler.y * 180) / Math.PI + 180, "deg) ") }, directionStyle), children: "E" }), _jsx("div", { className: "west direction", style: __assign({ transform: props.blockRotate || mode.control === "normal"
43
43
  ? "translate(50%, -50%) rotate(180deg) "
@@ -53,7 +53,7 @@ export function MiniMap(props) {
53
53
  var Z = (center.z - activeState.position.z) *
54
54
  (props.angle ? -Math.cos(props.angle) : 1) *
55
55
  scale;
56
- return (_jsxs("div", { children: [_jsx("div", { className: "minimapObject", style: __assign({ width: "".concat(size.x * scale, "rem"), height: "".concat(size.z * scale, "rem"), top: "50%", left: "50%", transform: "translate(-50.1%, -50.1%) translate(".concat(-X, "rem, ").concat(-Z, "rem) rotate(").concat((Math.PI * 3) / 2 + props.angle || 0, "rad)"), transformOrigin: "50% 50%", zIndex: 1 + key }, minimapObjectStyle) }), key === 0 && (_jsx("div", { className: "imageObject", style: __assign({ width: "".concat(size.x * scale, "rem"), height: "".concat(size.z * scale, "rem"), top: "50%", left: "50%", transform: "translate(-50.1%, -50.1%) translate(".concat(-X, "rem, ").concat(-Z, "rem) rotate(").concat((Math.PI * 3) / 2 + props.angle || 0, "rad)"), transformOrigin: "50% 50%", zIndex: 10 + key }, imageStyle) })), _jsx("div", { className: "textObject", style: {
56
+ return (_jsxs("div", { children: [_jsx("div", { className: "minimapObject", style: __assign({ width: "".concat(size.x * scale, "rem"), height: "".concat(size.z * scale, "rem"), top: "50%", left: "50%", transform: "translate(-50.1%, -50.1%) translate(".concat(-X, "rem, ").concat(-Z, "rem) rotate(").concat((Math.PI * 3) / 2 + props.angle || 0, "rad)"), transformOrigin: "50% 50%", zIndex: 1 + key }, objectStyle) }), key === 0 && (_jsx("div", { className: "imageObject", style: __assign({ width: "".concat(size.x * scale, "rem"), height: "".concat(size.z * scale, "rem"), top: "50%", left: "50%", transform: "translate(-50.1%, -50.1%) translate(".concat(-X, "rem, ").concat(-Z, "rem) rotate(").concat((Math.PI * 3) / 2 + props.angle || 0, "rad)"), transformOrigin: "50% 50%", zIndex: 10 + key }, imageStyle) })), _jsx("div", { className: "textObject", style: {
57
57
  width: "".concat(size.x * scale, "rem"),
58
58
  height: "".concat(size.z * scale, "rem"),
59
59
  top: "50.1%",
@@ -14,7 +14,7 @@ export type minimapInnerType = {
14
14
  };
15
15
  };
16
16
  export type minimapType = {
17
- [key in "minimapStyle" | "minimapOuterStyle" | "minimapInnerStyle" | "minimapObjectStyle" | "textStyle" | "objectStyle" | "avatarStyle" | "directionStyle" | "scaleStyle" | "imageStyle" | "plusMinusStyle"]?: CSSProperties;
17
+ [key in "minimapStyle" | "outerStyle" | "innerStyle" | "textStyle" | "objectStyle" | "avatarStyle" | "directionStyle" | "scaleStyle" | "imageStyle" | "plusMinusStyle"]?: CSSProperties;
18
18
  } & {
19
19
  minScale?: number;
20
20
  maxScale?: number;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import * as THREE from "three";
3
+ import "./style.css";
4
+ export type zoomButtonPropsType = {
5
+ children?: React.ReactNode;
6
+ position: THREE.Vector3;
7
+ target?: THREE.Vector3;
8
+ keepBlocking?: boolean;
9
+ zoomButtonStyle?: React.CSSProperties;
10
+ };
11
+ export declare function useZoom(): {
12
+ setZoom: (position: THREE.Vector3, isZoom: boolean) => Promise<void>;
13
+ openCamera: () => Promise<void>;
14
+ closeCamera: (position: THREE.Vector3) => Promise<void>;
15
+ isZoom: boolean;
16
+ setIsZoom: import("react").Dispatch<import("react").SetStateAction<boolean>>;
17
+ moveToCamera: () => Promise<void>;
18
+ };
19
+ export declare function ZoomButton(props: zoomButtonPropsType): import("react/jsx-runtime").JSX.Element;
@@ -1,102 +1,146 @@
1
- // import { useContext, useState } from "react";
2
- // import * as THREE from "three";
3
- // import { makeNormalCameraPosition } from "../../camera/control/normal";
4
- // import { makeOrbitCameraPosition } from "../../camera/control/orbit";
5
- // import {
6
- // GaesupWorldContext,
7
- // GaesupWorldDispatchContext,
8
- // } from "../../world/context/index";
9
- // import "./style.css";
10
- //
11
- // export type zoomButtonPropsType = {
12
- // children?: React.ReactNode;
13
- // position: THREE.Vector3;
14
- // target?: THREE.Vector3;
15
- // keepBlocking?: boolean;
16
- // zoomButtonStyle?: React.CSSProperties;
17
- // };
18
- //
19
- // export function useZoom() {
20
- // const { moveTo, activeState, cameraOption, mode, block } =
21
- // useContext(GaesupWorldContext);
22
- // const dispatch = useContext(GaesupWorldDispatchContext);
23
- // const [isZoom, setIsZoom] = useState(true);
24
- //
25
- // const closeCamera = async (position: THREE.Vector3) => {
26
- // cameraOption.XDistance = position.x;
27
- // cameraOption.YDistance = position.y;
28
- // cameraOption.ZDistance = position.z;
29
- // block.camera = true;
30
- // dispatch({
31
- // type: "update",
32
- // payload: {
33
- // block: {
34
- // ...block,
35
- // },
36
- // cameraOption: {
37
- // ...cameraOption,
38
- // },
39
- // },
40
- // });
41
- // };
42
- //
43
- // const openCamera = async () => {
44
- // block.camera = false;
45
- // dispatch({
46
- // type: "update",
47
- // payload: {
48
- // block: {
49
- // ...block,
50
- // },
51
- // },
52
- // });
53
- // };
54
- //
55
- // const moveToCamera = async () => {
56
- // if (mode.control === "orbit" && moveTo) {
57
- // await moveTo(
58
- // makeOrbitCameraPosition(activeState, cameraOption),
59
- // activeState.position
60
- // );
61
- // } else if (mode.control === "normal" && moveTo) {
62
- // await moveTo(
63
- // makeNormalCameraPosition(activeState, cameraOption),
64
- // activeState.position
65
- // );
66
- // }
67
- // };
68
- //
69
- // const setZoom = async (position: THREE.Vector3, isZoom: boolean) => {
70
- // setIsZoom(isZoom);
71
- // await closeCamera(position);
72
- // await moveToCamera();
73
- // await openCamera();
74
- // };
75
- //
76
- // return {
77
- // setZoom,
78
- // openCamera,
79
- // closeCamera,
80
- // isZoom,
81
- // setIsZoom,
82
- // moveToCamera,
83
- // };
84
- // }
85
- //
86
- // export function ZoomButton(props: zoomButtonPropsType) {
87
- // const { setZoom, isZoom } = useZoom();
88
- //
89
- // return (
90
- // <div
91
- // className="zoomButton"
92
- // style={{
93
- // ...props.zoomButtonStyle,
94
- // }}
95
- // onClick={async () => {
96
- // await setZoom(props.position, isZoom);
97
- // }}
98
- // >
99
- // {props.children}
100
- // </div>
101
- // );
102
- // }
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx } from "react/jsx-runtime";
49
+ import { useContext, useState } from "react";
50
+ import { makeNormalCameraPosition } from "../../camera/control/normal";
51
+ import { makeOrbitCameraPosition } from "../../camera/control/orbit";
52
+ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context/index";
53
+ import "./style.css";
54
+ export function useZoom() {
55
+ var _this = this;
56
+ var _a = useContext(GaesupWorldContext), moveTo = _a.moveTo, activeState = _a.activeState, cameraOption = _a.cameraOption, mode = _a.mode, block = _a.block;
57
+ var dispatch = useContext(GaesupWorldDispatchContext);
58
+ var _b = useState(true), isZoom = _b[0], setIsZoom = _b[1];
59
+ var closeCamera = function (position) { return __awaiter(_this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ cameraOption.XDistance = position.x;
62
+ cameraOption.YDistance = position.y;
63
+ cameraOption.ZDistance = position.z;
64
+ block.camera = true;
65
+ dispatch({
66
+ type: "update",
67
+ payload: {
68
+ block: __assign({}, block),
69
+ cameraOption: __assign({}, cameraOption),
70
+ },
71
+ });
72
+ return [2 /*return*/];
73
+ });
74
+ }); };
75
+ var openCamera = function () { return __awaiter(_this, void 0, void 0, function () {
76
+ return __generator(this, function (_a) {
77
+ block.camera = false;
78
+ dispatch({
79
+ type: "update",
80
+ payload: {
81
+ block: __assign({}, block),
82
+ },
83
+ });
84
+ return [2 /*return*/];
85
+ });
86
+ }); };
87
+ var moveToCamera = function () { return __awaiter(_this, void 0, void 0, function () {
88
+ return __generator(this, function (_a) {
89
+ switch (_a.label) {
90
+ case 0:
91
+ if (!(mode.control === "orbit" && moveTo)) return [3 /*break*/, 2];
92
+ return [4 /*yield*/, moveTo(makeOrbitCameraPosition(activeState, cameraOption), activeState.position)];
93
+ case 1:
94
+ _a.sent();
95
+ return [3 /*break*/, 4];
96
+ case 2:
97
+ if (!(mode.control === "normal" && moveTo)) return [3 /*break*/, 4];
98
+ return [4 /*yield*/, moveTo(makeNormalCameraPosition(activeState, cameraOption), activeState.position)];
99
+ case 3:
100
+ _a.sent();
101
+ _a.label = 4;
102
+ case 4: return [2 /*return*/];
103
+ }
104
+ });
105
+ }); };
106
+ var setZoom = function (position, isZoom) { return __awaiter(_this, void 0, void 0, function () {
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
109
+ case 0:
110
+ setIsZoom(isZoom);
111
+ return [4 /*yield*/, closeCamera(position)];
112
+ case 1:
113
+ _a.sent();
114
+ return [4 /*yield*/, moveToCamera()];
115
+ case 2:
116
+ _a.sent();
117
+ return [4 /*yield*/, openCamera()];
118
+ case 3:
119
+ _a.sent();
120
+ return [2 /*return*/];
121
+ }
122
+ });
123
+ }); };
124
+ return {
125
+ setZoom: setZoom,
126
+ openCamera: openCamera,
127
+ closeCamera: closeCamera,
128
+ isZoom: isZoom,
129
+ setIsZoom: setIsZoom,
130
+ moveToCamera: moveToCamera,
131
+ };
132
+ }
133
+ export function ZoomButton(props) {
134
+ var _this = this;
135
+ var _a = useZoom(), setZoom = _a.setZoom, isZoom = _a.isZoom;
136
+ return (_jsx("div", { className: "zoomButton", style: __assign({}, props.zoomButtonStyle), onClick: function () { return __awaiter(_this, void 0, void 0, function () {
137
+ return __generator(this, function (_a) {
138
+ switch (_a.label) {
139
+ case 0: return [4 /*yield*/, setZoom(props.position, isZoom)];
140
+ case 1:
141
+ _a.sent();
142
+ return [2 /*return*/];
143
+ }
144
+ });
145
+ }); }, children: props.children }));
146
+ }
@@ -114,6 +114,7 @@ export var gaesupWorldDefault = {
114
114
  position: vec3(),
115
115
  focus: false,
116
116
  },
117
+ moveTo: null,
117
118
  rideable: {},
118
119
  sizes: {},
119
120
  block: {
@@ -122,9 +123,8 @@ export var gaesupWorldDefault = {
122
123
  animation: false,
123
124
  scroll: true,
124
125
  },
125
- clickerOption: {
126
- isRun: true,
127
- throttle: 100,
126
+ callback: {
127
+ moveTo: null,
128
128
  },
129
129
  };
130
130
  export var GaesupWorldContext = createContext(null);
@@ -17,11 +17,14 @@ export declare function gaesupWorldReducer(props: Partial<gaesupWorldContextType
17
17
  animationState?: import("./type").animationStateType;
18
18
  keyBoardMap?: import("../../tools/keyBoardToolTip/type").keyboardMapType;
19
19
  cameraOption?: import("./type").cameraOptionType;
20
- clickerOption?: import("./type").clickerOptionType;
21
20
  clicker?: import("./type").clickerType;
21
+ moveTo?: (position: import("three").Vector3, target: import("three").Vector3) => Promise<void>;
22
22
  rideable?: {
23
23
  [key: string]: import("../../hooks/useRideable/type").rideableType;
24
24
  };
25
25
  sizes?: import("./type").sizesType;
26
26
  block?: import("./type").blockType;
27
+ callback?: {
28
+ moveTo: (position: import("three").Vector3, target: import("three").Vector3) => Promise<void>;
29
+ };
27
30
  };
@@ -107,10 +107,6 @@ export type clickerType = {
107
107
  isOn: boolean;
108
108
  isRun: boolean;
109
109
  };
110
- export type clickerOptionType = {
111
- isRun: boolean;
112
- throttle: number;
113
- };
114
110
  export type wheelStateType = {
115
111
  position: THREE.Vector3;
116
112
  rotation: THREE.Euler;
@@ -160,13 +156,16 @@ export type gaesupWorldContextType = {
160
156
  animationState: animationStateType;
161
157
  keyBoardMap: keyboardMapType;
162
158
  cameraOption: cameraOptionType;
163
- clickerOption: clickerOptionType;
164
159
  clicker: clickerType;
160
+ moveTo: (position: THREE.Vector3, target: THREE.Vector3) => Promise<void>;
165
161
  rideable: {
166
162
  [key: string]: rideableType;
167
163
  };
168
164
  sizes: sizesType;
169
165
  block: blockType;
166
+ callback: {
167
+ moveTo: (position: THREE.Vector3, target: THREE.Vector3) => Promise<void>;
168
+ };
170
169
  };
171
170
  export type gaesupDisptachType = dispatchType<gaesupWorldContextType>;
172
171
  export {};
@@ -17,13 +17,16 @@ export default function initGaesupWorld(props: gaesupWorldPropsType): {
17
17
  animationState?: import("../context/type").animationStateType;
18
18
  keyBoardMap?: import("../../tools/keyBoardToolTip/type").keyboardMapType;
19
19
  cameraOption?: import("../context/type").cameraOptionType;
20
- clickerOption?: import("../context/type").clickerOptionType;
21
20
  clicker?: import("../context/type").clickerType;
21
+ moveTo?: (position: import("three").Vector3, target: import("three").Vector3) => Promise<void>;
22
22
  rideable?: {
23
23
  [key: string]: import("../../hooks/useRideable/type").rideableType;
24
24
  };
25
25
  sizes?: import("../context/type").sizesType;
26
26
  block?: import("../context/type").blockType;
27
+ callback?: {
28
+ moveTo: (position: import("three").Vector3, target: import("three").Vector3) => Promise<void>;
29
+ };
27
30
  };
28
31
  dispatch: import("react").Dispatch<{
29
32
  type: string;
@@ -27,12 +27,15 @@ export default function initGaesupWorld(props) {
27
27
  minimap: gaesupWorldDefault.minimap,
28
28
  joystick: gaesupWorldDefault.joystick,
29
29
  control: gaesupWorldDefault.control,
30
- clicker: gaesupWorldDefault.clicker,
31
- clickerOption: Object.assign(gaesupWorldDefault.clickerOption, props.clickerOption || {}),
30
+ clicker: Object.assign(gaesupWorldDefault.clicker, props.clicker || {}),
32
31
  animationState: gaesupWorldDefault.animationState,
33
32
  keyBoardMap: Object.assign(gaesupWorldDefault.keyBoardMap, props.keyBoardMap || {}),
33
+ moveTo: null,
34
34
  block: Object.assign(gaesupWorldDefault.block, props.block || {}),
35
35
  sizes: gaesupWorldDefault.sizes,
36
+ callback: {
37
+ moveTo: null,
38
+ },
36
39
  }), value = _a[0], dispatch = _a[1];
37
40
  useEffect(function () {
38
41
  var _a;
@@ -2,7 +2,7 @@ import { ReactNode } from "react";
2
2
  import * as THREE from "three";
3
3
  import { keyboardMapType } from "../tools/keyBoardToolTip/type";
4
4
  import { dispatchType } from "../utils/type";
5
- import { blockType, cameraOptionType, clickerOptionType, gaesupWorldContextType, modeType, urlsType } from "./context/type";
5
+ import { blockType, cameraOptionType, clickerType, gaesupWorldContextType, modeType, urlsType } from "./context/type";
6
6
  export type gaesupWorldInitType = {
7
7
  value: gaesupWorldContextType;
8
8
  dispatch: dispatchType<gaesupWorldContextType>;
@@ -15,6 +15,7 @@ export type gaesupWorldPropsType = {
15
15
  debug?: boolean;
16
16
  keyBoardMap?: keyboardMapType;
17
17
  cameraOption?: cameraOptionType;
18
+ moveTo?: (position: THREE.Vector3, target: THREE.Vector3) => void;
18
19
  block?: blockType;
19
- clickerOption?: clickerOptionType;
20
+ clicker?: clickerType;
20
21
  };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { JumpPortal } from "./gaesup/tools/jumpPortal";
12
12
  export { KeyBoardToolTip } from "./gaesup/tools/keyBoardToolTip";
13
13
  export { MiniMap } from "./gaesup/tools/miniMap";
14
14
  export { Rideable } from "./gaesup/tools/rideable";
15
+ export { ZoomButton } from "./gaesup/tools/zoomButton";
15
16
  export { InnerHtml } from "./gaesup/utils/innerHtml";
16
17
  export { Elr, Qt, V3, V30, V31 } from "./gaesup/utils/vector";
17
18
  export { GaesupWorld } from "./gaesup/world";
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ export { JumpPortal } from "./gaesup/tools/jumpPortal";
12
12
  export { KeyBoardToolTip } from "./gaesup/tools/keyBoardToolTip";
13
13
  export { MiniMap } from "./gaesup/tools/miniMap";
14
14
  export { Rideable } from "./gaesup/tools/rideable";
15
- // export { ZoomButton } from "./gaesup/tools/zoomButton";
15
+ export { ZoomButton } from "./gaesup/tools/zoomButton";
16
16
  export { InnerHtml } from "./gaesup/utils/innerHtml";
17
17
  export { Elr, Qt, V3, V30, V31 } from "./gaesup/utils/vector";
18
18
  export { GaesupWorld } from "./gaesup/world";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.8.2",
3
+ "version": "0.8.12",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,6 @@
13
13
  "@react-three/fiber": "8.16.2",
14
14
  "@react-three/postprocessing": "^2.16.2",
15
15
  "@react-three/rapier": "^1.3.1",
16
- "@types/lodash": "^4.17.0",
17
16
  "@types/three": "^0.164.0",
18
17
  "gh-pages": "^6.1.1",
19
18
  "jotai": "^2.8.0",
@@ -29,6 +28,7 @@
29
28
  "three-stdlib": "^2.29.7"
30
29
  },
31
30
  "devDependencies": {
31
+ "@types/lodash": "^4.17.0",
32
32
  "@types/react": "^18.3.1",
33
33
  "@types/react-dom": "^18.3.0",
34
34
  "@vanilla-extract/css": "^1.14.2",