@gamelearn/arcade-components 2.17.5 → 2.17.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.
@@ -43,7 +43,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
43
 
44
44
  var isMobile = (0, _deviceDetection.DeviceDetection)();
45
45
  var defaultCamPos = [0, 14.63, 16];
46
- var boneWhiteList = ['l_eye_jnt', 'l_eye', 'eye_l'];
46
+ var boneWhiteList = ['l_eye_jnt', 'l_eye', 'eye_l', 'head_m'];
47
47
 
48
48
  function Panel(_ref) {
49
49
  var _character$resource4, _character$resource6, _character$resource6$, _character$resource6$2, _character$resource7;
@@ -55,6 +55,7 @@ function Panel(_ref) {
55
55
  var cameraRef = (0, _react.useRef)(null);
56
56
  var sceneRef = (0, _react.useRef)(null);
57
57
  var isCharacter = character.type === 'character';
58
+ var ref = (0, _react.useRef)();
58
59
 
59
60
  var _useState = (0, _react.useState)(false),
60
61
  _useState2 = _slicedToArray(_useState, 2),
@@ -134,13 +135,17 @@ function Panel(_ref) {
134
135
  var isSeated = (_character$emotion = character.emotion) === null || _character$emotion === void 0 ? void 0 : _character$emotion.includes('seated');
135
136
  cameraRef.current.position.setY(size.y - 1.5 * 1.3); // Retro compatible with resources without eye bone
136
137
 
137
- object.traverse(function (obj) {
138
- var boneName = obj.name.toLowerCase();
138
+ object.traverse(function (node) {
139
+ var boneName = node.name.toLowerCase();
140
+
141
+ if (node.isBone && boneWhiteList.includes(boneName)) {
142
+ var distance = isSeated ? 1 : 0;
143
+ var leftEyeVector = new _three.Vector3().setFromMatrixPosition(node.matrixWorld);
144
+
145
+ if (boneName === 'head_m' && !isSeated) {
146
+ cameraRef.current.lookAt(leftEyeVector);
147
+ }
139
148
 
140
- if (obj.isBone && boneWhiteList.includes(boneName)) {
141
- var distance = isSeated ? 5 : 0.5;
142
- var leftEyeVector = new _three.Vector3().setFromMatrixPosition(obj.matrixWorld);
143
- cameraRef.current.position.setX(leftEyeVector.x - 0.5);
144
149
  cameraRef.current.position.setY(leftEyeVector.y - distance);
145
150
  }
146
151
  });
@@ -172,6 +177,11 @@ function Panel(_ref) {
172
177
  left: child.left - parent.left,
173
178
  bottom: child.bottom - parent.bottom
174
179
  };
180
+
181
+ if (ref.current) {
182
+ onLoadElement(ref.current);
183
+ }
184
+
175
185
  var paddingBottom = isMobile ? 24 : 40;
176
186
  relativePos.bottom += active ? -paddingBottom : paddingBottom;
177
187
  gl.setViewport(relativePos.left, relativePos.bottom, width, height);
@@ -185,6 +195,7 @@ function Panel(_ref) {
185
195
  }, (_character$resource7 = character.resource) !== null && _character$resource7 !== void 0 && _character$resource7.url ? /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.LodWrapper, {
186
196
  lod: currentLOD
187
197
  }, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.TriggerWrapper, {
198
+ ref: ref,
188
199
  name: "char_".concat(character.uid),
189
200
  url: character.resource.url,
190
201
  animationUrl: emotion.url,
@@ -82,10 +82,11 @@ var LecturesComponent = function LecturesComponent(_ref) {
82
82
  var textWithDotsBeforeClosingTags = text.replace(regexForClosingTags, '. </p>');
83
83
  var textWithoutStringsToDelete = textWithDotsBeforeClosingTags.replace(stringsToDelete, '');
84
84
  var textParsedForTTSwithoutHtmlTags = textWithoutStringsToDelete.replace(/(<([^>]+)>)/gi, '');
85
+ var TitleAndTextParsedForTTSwithoutHtmlTags = "".concat(name, ". ").concat(textParsedForTTSwithoutHtmlTags);
85
86
  (0, _useEkho.default)({
86
87
  audioType: audioType,
87
88
  voice: voice,
88
- text: textParsedForTTSwithoutHtmlTags,
89
+ text: TitleAndTextParsedForTTSwithoutHtmlTags,
89
90
  audio: audio,
90
91
  soundActions: soundActions,
91
92
  emitEvent: emitEvent,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "author": "Gamelearn",
4
4
  "license": "unlicense",
5
- "version": "2.17.5",
5
+ "version": "2.17.7",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",