gaesup-world 0.8.22 → 0.8.24

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,7 +18,7 @@ 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 minimap = useContext(GaesupWorldContext).minimap;
21
+ var _c = useContext(GaesupWorldContext), minimap = _c.minimap, clickerOption = _c.clickerOption;
22
22
  var dispatch = useContext(GaesupWorldDispatchContext);
23
23
  // clicker
24
24
  var moveClicker = useClicker().moveClicker;
@@ -42,5 +42,22 @@ export function GaeSupProps(_a) {
42
42
  });
43
43
  }
44
44
  }, []);
45
- return (_jsx("group", { ref: groupRef, position: position, onPointerDown: function (e) { return moveClicker(e, false, type); }, children: children }));
45
+ var lastClickTime = 0;
46
+ function handleClick(e, cb, gap) {
47
+ var currentTime = new Date().getTime();
48
+ var timeDiff = currentTime - lastClickTime;
49
+ if (timeDiff < gap) {
50
+ e.preventDefault();
51
+ return;
52
+ }
53
+ else {
54
+ cb(e);
55
+ lastClickTime = currentTime;
56
+ }
57
+ }
58
+ return (_jsx("group", { ref: groupRef, position: position, onPointerDown: function (e) {
59
+ handleClick(e, moveClicker, clickerOption.throttle || 100);
60
+ }, onDoubleClick: function (e) {
61
+ e.stopPropagation();
62
+ }, children: children }));
46
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.8.22",
3
+ "version": "0.8.24",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",