gaesup-world 0.8.15 → 0.8.16

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.
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { vec3 } from "@react-three/rapier";
14
+ import * as _ from "lodash";
14
15
  import { useContext, useEffect, useRef } from "react";
15
16
  import * as THREE from "three";
16
17
  import { useClicker } from "../hooks/useClicker";
@@ -18,7 +19,7 @@ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/contex
18
19
  export function GaeSupProps(_a) {
19
20
  var _b = _a.type, type = _b === void 0 ? "normal" : _b, text = _a.text, position = _a.position, children = _a.children;
20
21
  var groupRef = useRef(null);
21
- var minimap = useContext(GaesupWorldContext).minimap;
22
+ var _c = useContext(GaesupWorldContext), minimap = _c.minimap, clickerOption = _c.clickerOption;
22
23
  var dispatch = useContext(GaesupWorldDispatchContext);
23
24
  // clicker
24
25
  var moveClicker = useClicker().moveClicker;
@@ -42,5 +43,8 @@ export function GaeSupProps(_a) {
42
43
  });
43
44
  }
44
45
  }, []);
45
- return (_jsx("group", { ref: groupRef, position: position, onPointerDown: function (e) { return moveClicker(e, false, type); }, onDoubleClick: function (e) { return moveClicker(e, true, type); }, children: children }));
46
+ var moveThrottleClicker = _.throttle(function (e) {
47
+ moveClicker(e, false, type);
48
+ }, 100);
49
+ return (_jsx("group", { ref: groupRef, position: position, onPointerDown: moveThrottleClicker, onDoubleClick: moveThrottleClicker, children: children }));
46
50
  }
@@ -128,6 +128,7 @@ export var gaesupWorldDefault = {
128
128
  },
129
129
  clickerOption: {
130
130
  isRun: true,
131
+ throttle: 100,
131
132
  },
132
133
  };
133
134
  export var GaesupWorldContext = createContext(null);
@@ -109,6 +109,7 @@ export type clickerType = {
109
109
  };
110
110
  export type clickerOptionType = {
111
111
  isRun: boolean;
112
+ throttle: number;
112
113
  };
113
114
  export type wheelStateType = {
114
115
  position: THREE.Vector3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.8.15",
3
+ "version": "0.8.16",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",