react-simple-game-engine 0.3.34 → 0.3.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"movement-control.d.ts","sourceRoot":"","sources":["../../src/ui-components/movement-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAMf,OAAO,EACL,cAAc,EAEf,MAAM,qCAAqC,CAAC;AAE7C,oBAAY,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1E,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC5E,CAAC;AACF,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,SAAS,CAAC;IACzC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,KAAK,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;CACzD,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,GAAG,EACH,IAAS,EACT,KAAK,EACL,MAAW,EACX,KAAK,EACL,mBAAmB,EACnB,QAAQ,GACT,EAAE,oBAAoB,eA+FtB"}
1
+ {"version":3,"file":"movement-control.d.ts","sourceRoot":"","sources":["../../src/ui-components/movement-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAMf,OAAO,EACL,cAAc,EAEf,MAAM,qCAAqC,CAAC;AAE7C,oBAAY,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1E,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC5E,CAAC;AACF,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,SAAS,CAAC;IACzC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,KAAK,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;CACzD,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,GAAG,EACH,IAAS,EACT,KAAK,EACL,MAAW,EACX,KAAK,EACL,mBAAmB,EACnB,QAAQ,GACT,EAAE,oBAAoB,eAyGtB"}
@@ -48,17 +48,29 @@ export function MovementControl(_a) {
48
48
  }
49
49
  };
50
50
  var joystick = (_jsx(Joystick, __assign({ size: 60, baseColor: "#2D2D2D", stickColor: "rgb(120,121,122)", throttle: 100 }, props, { start: onAction, move: onAction, stop: onAction })));
51
+ var isReleased = false;
52
+ var handleTouchDown = function () {
53
+ var _a, _b, _c;
54
+ isReleased = false;
55
+ (_a = containerTouchEvent === null || containerTouchEvent === void 0 ? void 0 : containerTouchEvent.onPressed) === null || _a === void 0 ? void 0 : _a.call(containerTouchEvent, refJoyWrap.current, refStick.current);
56
+ (_c = (_b = joystickConfigs === null || joystickConfigs === void 0 ? void 0 : joystickConfigs.containerTouchEvent) === null || _b === void 0 ? void 0 : _b.onPressed) === null || _c === void 0 ? void 0 : _c.call(_b, refJoyWrap.current, refStick.current);
57
+ };
58
+ var handleTouchUp = function () {
59
+ var _a, _b, _c;
60
+ if (isReleased) {
61
+ return;
62
+ }
63
+ isReleased = true;
64
+ (_a = containerTouchEvent === null || containerTouchEvent === void 0 ? void 0 : containerTouchEvent.onReleased) === null || _a === void 0 ? void 0 : _a.call(containerTouchEvent, refJoyWrap.current, refStick.current);
65
+ (_c = (_b = joystickConfigs === null || joystickConfigs === void 0 ? void 0 : joystickConfigs.containerTouchEvent) === null || _b === void 0 ? void 0 : _b.onReleased) === null || _c === void 0 ? void 0 : _c.call(_b, refJoyWrap.current, refStick.current);
66
+ };
51
67
  return (_jsx("div", __assign({ ref: refJoyWrap, onPointerDown: function (event) {
52
- var _a, _b, _c;
53
68
  event.target.setPointerCapture(event.pointerId);
54
- (_a = containerTouchEvent === null || containerTouchEvent === void 0 ? void 0 : containerTouchEvent.onPressed) === null || _a === void 0 ? void 0 : _a.call(containerTouchEvent, refJoyWrap.current, refStick.current);
55
- (_c = (_b = joystickConfigs === null || joystickConfigs === void 0 ? void 0 : joystickConfigs.containerTouchEvent) === null || _b === void 0 ? void 0 : _b.onPressed) === null || _c === void 0 ? void 0 : _c.call(_b, refJoyWrap.current, refStick.current);
69
+ handleTouchDown();
56
70
  }, onPointerUp: function (event) {
57
- var _a, _b, _c;
58
71
  event.target.releasePointerCapture(event.pointerId);
59
- (_a = containerTouchEvent === null || containerTouchEvent === void 0 ? void 0 : containerTouchEvent.onReleased) === null || _a === void 0 ? void 0 : _a.call(containerTouchEvent, refJoyWrap.current, refStick.current);
60
- (_c = (_b = joystickConfigs === null || joystickConfigs === void 0 ? void 0 : joystickConfigs.containerTouchEvent) === null || _b === void 0 ? void 0 : _b.onReleased) === null || _c === void 0 ? void 0 : _c.call(_b, refJoyWrap.current, refStick.current);
61
- }, style: {
72
+ handleTouchUp();
73
+ }, onMouseLeave: handleTouchUp, style: {
62
74
  position: "absolute",
63
75
  left: right != null ? undefined : left,
64
76
  right: right,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-game-engine",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",