@gamelearn/arcade-components 0.25.6 → 0.25.7

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.
@@ -55,7 +55,13 @@ var AnimateElement = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
55
55
  var mouseEvents = {
56
56
  onClick: onClick,
57
57
  onPointerOver: onPointerOver,
58
- onPointerOut: onPointerOut
58
+ onPointerOut: onPointerOut,
59
+ onPointerCancel: props.onPointerCancel,
60
+ onPointerDown: props.onPointerDown,
61
+ onPointerEnter: props.onPointerEnter,
62
+ onPointerLeave: props.onPointerLeave,
63
+ onPointerMove: props.onPointerMove,
64
+ onPointerUp: props.onPointerUp
59
65
  };
60
66
 
61
67
  var currentProps = _objectSpread(_objectSpread({}, enableBounding ? {} : mouseEvents), props);
@@ -89,16 +95,26 @@ var AnimateElement = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
89
95
  visible: props.visible
90
96
  }, enableBounding ? /*#__PURE__*/_react.default.createElement(_BoundingBox.default, _extends({
91
97
  model: model,
92
- position: position,
93
- rotation: rotation,
94
98
  layers: layers
95
99
  }, mouseEvents)) : null, /*#__PURE__*/_react.default.createElement("primitive", _extends({
96
100
  ref: getRef,
97
101
  object: model,
98
102
  position: position,
99
- rotation: rotation
103
+ rotation: rotation,
104
+ raycast: enableBounding ? null : _drei.meshBounds
100
105
  }, currentProps)));
101
106
  });
102
107
 
108
+ AnimateElement.defaultProps = {
109
+ onClick: function onClick() {},
110
+ onPointerOver: function onPointerOver() {},
111
+ onPointerOut: function onPointerOut() {},
112
+ onPointerCancel: function onPointerCancel() {},
113
+ onPointerDown: function onPointerDown() {},
114
+ onPointerEnter: function onPointerEnter() {},
115
+ onPointerLeave: function onPointerLeave() {},
116
+ onPointerMove: function onPointerMove() {},
117
+ onPointerUp: function onPointerUp() {}
118
+ };
103
119
  var _default = AnimateElement;
104
120
  exports.default = _default;
@@ -23,25 +23,29 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
23
23
 
24
24
  var BoundingBox = function BoundingBox(_ref) {
25
25
  var model = _ref.model,
26
- rotation = _ref.rotation,
27
- position = _ref.position,
28
26
  visible = _ref.visible,
29
- props = _objectWithoutProperties(_ref, ["model", "rotation", "position", "visible"]);
27
+ props = _objectWithoutProperties(_ref, ["model", "visible"]);
30
28
 
31
29
  var bounding = (0, _react.useRef)();
32
30
  (0, _react.useEffect)(function () {
33
31
  if (model && bounding.current) {
34
- var box = new _three.Box3().setFromObject(model);
35
- var size = box.getSize(new _three.Vector3());
36
- bounding.current.scale.copy(size);
37
- bounding.current.scale.x /= 2;
38
- bounding.current.position.y = size.y / 2;
32
+ var updatePosition = function updatePosition() {
33
+ var box = new _three.Box3().setFromObject(model);
34
+ var size = box.getSize(new _three.Vector3());
35
+ bounding.current.position.copy(model.position);
36
+ bounding.current.rotation.copy(model.rotation);
37
+ bounding.current.scale.copy(size);
38
+ bounding.current.scale.x /= 2;
39
+ bounding.current.position.y += size.y / 2;
40
+ };
41
+
42
+ updatePosition();
43
+ bounding.current.updatePosition = updatePosition;
44
+ model.brother = bounding.current;
39
45
  }
40
- }, [model, position]);
46
+ }, [model]);
41
47
  return /*#__PURE__*/_react.default.createElement("mesh", _extends({
42
- ref: bounding,
43
- position: position,
44
- rotation: rotation
48
+ ref: bounding
45
49
  }, props), /*#__PURE__*/_react.default.createElement("boxGeometry", {
46
50
  args: [1, 1, 1]
47
51
  }), /*#__PURE__*/_react.default.createElement("meshBasicMaterial", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "license": "Gamelearn",
4
- "version": "0.25.6",
4
+ "version": "0.25.7",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist",