@gamelearn/arcade-components 0.12.0 → 0.14.0

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.
Files changed (50) hide show
  1. package/dist/components/arcade-render/loading/LoadingLogic.js +4 -3
  2. package/dist/components/arcade-render/scene/ConfigController.js +70 -4
  3. package/dist/components/arcade-render/scene/index.js +8 -3
  4. package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +7 -1
  5. package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +1 -0
  6. package/dist/components/cartel-component/components/CartelComponent.js +24 -6
  7. package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +7 -2
  8. package/dist/components/conversational-component/components/ConversationalComponent.js +3 -1
  9. package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +5 -2
  10. package/dist/components/conversational-pro-component/components/SlotList.js +3 -1
  11. package/dist/components/conversational-pro-component/components/scene/Panel.js +4 -3
  12. package/dist/components/conversational-pro-component/components/scene/Panels.js +4 -2
  13. package/dist/components/conversational-pro-component/components/scene/index.js +4 -2
  14. package/dist/components/conversational-pro-component/mocks/mockForStory.js +266 -2
  15. package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +11 -21
  16. package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +1 -0
  17. package/dist/components/decision-component/components/DecisionBody.js +0 -2
  18. package/dist/components/decision-component/components/DecisionComponent.js +9 -2
  19. package/dist/components/decision-component/components/Feedback.js +0 -2
  20. package/dist/components/decision-component/mocks/mockForStory.js +20 -6
  21. package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +0 -1
  22. package/dist/components/frame-click-puzzle-component/components/PlayButton/index.js +2 -2
  23. package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +6 -8
  24. package/dist/components/hacker-puzzle-component/components/languages.js +2 -1
  25. package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +3 -0
  26. package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +33 -64
  27. package/dist/components/index.js +8 -0
  28. package/dist/components/inventory-item/components/InventoryItem.js +3 -2
  29. package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +10 -1
  30. package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +1 -0
  31. package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +6 -0
  32. package/dist/components/login-puzzle-component/mocks/mockForStory.js +1 -0
  33. package/dist/components/media-visor/components/MediaVisor.js +140 -0
  34. package/dist/components/media-visor/index.js +13 -0
  35. package/dist/components/media-visor/mocks/mockForStory.js +27 -0
  36. package/dist/components/pdf-component/components/PdfComponent.js +1 -1
  37. package/dist/components/pdf-component/components/PdfVisor.js +4 -5
  38. package/dist/components/rewards-component/components/RewardsComponent.js +0 -1
  39. package/dist/components/survey-component/components/SurveyComponent.js +13 -8
  40. package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +6 -1
  41. package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +1 -0
  42. package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +5 -0
  43. package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +1 -0
  44. package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +7 -6
  45. package/dist/components/writer-puzzle-component/mocks/mockForStory.js +1 -0
  46. package/dist/helpers/deviceDetection.js +13 -0
  47. package/dist/helpers/drawLOD.js +16 -10
  48. package/dist/helpers/index.js +7 -1
  49. package/dist/helpers/useWindowSize.js +56 -0
  50. package/package.json +4 -4
@@ -28,7 +28,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
28
28
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
29
 
30
30
  function LoadingLogic(_ref) {
31
- var onFinish = _ref.onFinish;
31
+ var onFinish = _ref.onFinish,
32
+ lodSettings = _ref.lodSettings;
32
33
  var progress = (0, _drei.useProgress)(function (state) {
33
34
  return state.progress;
34
35
  });
@@ -44,9 +45,9 @@ function LoadingLogic(_ref) {
44
45
  (0, _react.useEffect)(function () {
45
46
  if (percentage === 100) {
46
47
  onFinish();
47
- (0, _drawLOD.default)(scene, camera);
48
+ (0, _drawLOD.default)(scene, camera, lodSettings);
48
49
  }
49
- }, [onFinish, percentage, scene, camera]);
50
+ }, [onFinish, percentage, scene, camera, lodSettings]);
50
51
  return null;
51
52
  }
52
53
 
@@ -9,6 +9,10 @@ var _react = require("react");
9
9
 
10
10
  var _fiber = require("@react-three/fiber");
11
11
 
12
+ var _helpers = require("../../../helpers");
13
+
14
+ var _useWindowSize = require("../../../helpers/useWindowSize");
15
+
12
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
17
 
14
18
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -21,27 +25,89 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
21
25
 
22
26
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
27
 
28
+ var STD_RESOLUTION = 16 / 9;
29
+ var MOTION_LIMITER = 3.5;
30
+ var SPEED = 3;
31
+
24
32
  var ConfigController = function ConfigController(_ref) {
25
33
  var current = _ref.current;
26
34
 
27
35
  var _useThree = (0, _fiber.useThree)(function (state) {
28
- return [state.gl, state.scene, state.invalidate];
36
+ return [state.gl, state.scene, state.camera, state.invalidate];
29
37
  }),
30
- _useThree2 = _slicedToArray(_useThree, 3),
38
+ _useThree2 = _slicedToArray(_useThree, 4),
31
39
  gl = _useThree2[0],
32
40
  scene = _useThree2[1],
33
- invalidate = _useThree2[2];
41
+ camera = _useThree2[2],
42
+ invalidate = _useThree2[3];
43
+
44
+ var windowSize = (0, _useWindowSize.useWindowSize)();
45
+ var cameraRotation = (0, _react.useRef)({
46
+ left: 0,
47
+ center: 0,
48
+ right: 0
49
+ });
50
+ var movingCamera = (0, _react.useRef)(false);
51
+ var setCameraRotationView = (0, _react.useCallback)(function () {
52
+ var ratio = window.innerWidth / window.innerHeight;
53
+
54
+ if (ratio >= STD_RESOLUTION) {
55
+ return;
56
+ }
57
+
58
+ var threshold = (STD_RESOLUTION - ratio) / MOTION_LIMITER;
59
+
60
+ if (camera.rotation) {
61
+ cameraRotation.current = {
62
+ center: (0, _helpers.roundFloat)(camera.rotation.y, 3),
63
+ left: (0, _helpers.roundFloat)(camera.rotation.y + threshold, 3),
64
+ right: (0, _helpers.roundFloat)(camera.rotation.y - threshold, 3)
65
+ };
66
+ }
67
+ }, [camera]);
68
+ var moveByStep = (0, _react.useCallback)(function (goal, current, increment, delta) {
69
+ var acceleration = delta * SPEED;
34
70
 
71
+ if (increment && goal + acceleration > current) {
72
+ camera.rotation.y += acceleration;
73
+ } else if (!increment && goal + acceleration < current) {
74
+ camera.rotation.y -= acceleration;
75
+ } else {
76
+ movingCamera.current = false;
77
+ return;
78
+ }
79
+ }, [camera]);
80
+ var moveCamera = (0, _react.useCallback)(function (delta) {
81
+ var goal = cameraRotation.current[current.lookingSide];
82
+ var value = (0, _helpers.roundFloat)(camera.rotation.y, 3);
83
+ var increment = goal > value;
84
+
85
+ if (camera.rotation) {
86
+ moveByStep(goal, value, increment, delta);
87
+ }
88
+ }, [camera.rotation, current.lookingSide, moveByStep]);
35
89
  (0, _fiber.useFrame)(function (_ref2) {
36
90
  var gl = _ref2.gl,
37
91
  scene = _ref2.scene,
38
- camera = _ref2.camera;
92
+ camera = _ref2.camera,
93
+ clock = _ref2.clock;
39
94
  gl.render(scene, camera);
40
95
 
96
+ if (movingCamera.current) {
97
+ moveCamera(clock.getDelta());
98
+ }
99
+
41
100
  if (!current.animate) {
42
101
  invalidate();
43
102
  }
44
103
  }, 1);
104
+ (0, _react.useEffect)(function () {
105
+ movingCamera.current = true;
106
+ }, [current.lookingSide]);
107
+ (0, _react.useEffect)(function () {
108
+ setCameraRotationView();
109
+ }, [windowSize, setCameraRotationView]); // settings
110
+
45
111
  (0, _react.useEffect)(function () {
46
112
  gl.shadowMap.enabled = current.shadows;
47
113
 
@@ -50,8 +50,11 @@ var Scene = function Scene(_ref) {
50
50
  loadingText = _ref$loadingText === void 0 ? '' : _ref$loadingText,
51
51
  _ref$toggleShadows = _ref.toggleShadows,
52
52
  toggleShadows = _ref$toggleShadows === void 0 ? true : _ref$toggleShadows,
53
+ _ref$lodSettings = _ref.lodSettings,
54
+ lodSettings = _ref$lodSettings === void 0 ? {} : _ref$lodSettings,
53
55
  _ref$stopAnimate = _ref.stopAnimate,
54
56
  stopAnimate = _ref$stopAnimate === void 0 ? false : _ref$stopAnimate,
57
+ lookingSide = _ref.lookingSide,
55
58
  _ref$emitEvent = _ref.emitEvent,
56
59
  emitEvent = _ref$emitEvent === void 0 ? function () {} : _ref$emitEvent;
57
60
 
@@ -80,7 +83,7 @@ var Scene = function Scene(_ref) {
80
83
  }, [emitEvent]);
81
84
  (0, _react.useEffect)(function () {
82
85
  setShowLoad(true);
83
- }, [backgroundData, elements]);
86
+ }, [backgroundData, elements, lodSettings.currentLOD]);
84
87
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_fiber.Canvas, {
85
88
  className: "main-canvas",
86
89
  style: {
@@ -99,14 +102,16 @@ var Scene = function Scene(_ref) {
99
102
  }, /*#__PURE__*/_react.default.createElement(_ConfigController.default, {
100
103
  current: {
101
104
  shadows: toggleShadows,
102
- animate: stopAnimate
105
+ animate: stopAnimate,
106
+ lookingSide: lookingSide
103
107
  }
104
108
  }), /*#__PURE__*/_react.default.createElement(_react.Suspense, {
105
109
  fallback: /*#__PURE__*/_react.default.createElement(_loading.default, {
106
110
  text: loadingText
107
111
  })
108
112
  }, showLoad && /*#__PURE__*/_react.default.createElement(_loading.LoadingLogic, {
109
- onFinish: handleLoadFinish
113
+ onFinish: handleLoadFinish,
114
+ lodSettings: lodSettings
110
115
  }), elements.length ? /*#__PURE__*/_react.default.createElement(_elementsList.default, {
111
116
  elements: elements,
112
117
  eventHandler: emitEvent
@@ -44,7 +44,8 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
44
44
  info = _ref.info,
45
45
  cards = _ref.cards,
46
46
  disableExit = _ref.disableExit,
47
- setResolveAction = _ref.setResolveAction;
47
+ setResolveAction = _ref.setResolveAction,
48
+ soundActions = _ref.soundActions;
48
49
 
49
50
  var _useState = (0, _react.useState)(false),
50
51
  _useState2 = _slicedToArray(_useState, 2),
@@ -81,6 +82,9 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
81
82
  feedBackText = _useState14[0],
82
83
  setFeedBackText = _useState14[1];
83
84
 
85
+ var _soundActions = _slicedToArray(soundActions, 1),
86
+ playSound = _soundActions[0];
87
+
84
88
  var _endPuzzle = function endPuzzle() {
85
89
  setFeedbackResult(true);
86
90
  setFeedBackText(info.solution.right.desc);
@@ -89,6 +93,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
89
93
  var rewards = info.solution.right.rewards;
90
94
  var rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards));
91
95
  setTimeout(function () {
96
+ playSound('score');
92
97
  emitEvent({
93
98
  type: 'addPoints',
94
99
  payload: _toConsumableArray(rewardsData)
@@ -103,6 +108,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
103
108
  disableExit(true);
104
109
  setRewards([].concat(_toConsumableArray(accRewards), _toConsumableArray(info.solution.wrong.rewards)));
105
110
  setTimeout(function () {
111
+ playSound('fail');
106
112
  setFeedbackResult(false);
107
113
  disableExit(false);
108
114
  setFeedbackIsShown(false);
@@ -11,6 +11,7 @@ var emitEvent = function emitEvent() {
11
11
 
12
12
  var mockProps = {
13
13
  emitEvent: emitEvent,
14
+ soundActions: [function () {}, function () {}],
14
15
  disableExit: function disableExit() {},
15
16
  setResolveAction: function setResolveAction() {},
16
17
  cards: [{
@@ -13,11 +13,29 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
13
13
 
14
14
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
+
18
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
+
24
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
25
+
26
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
+
16
28
  var CartelComponent = function CartelComponent(_ref) {
17
29
  var img = _ref.img,
18
30
  text = _ref.text,
19
31
  audio = _ref.audio,
20
- emitEvent = _ref.emitEvent;
32
+ emitEvent = _ref.emitEvent,
33
+ soundActions = _ref.soundActions;
34
+ var textBox = (0, _react.useRef)();
35
+ var picture = (0, _react.useRef)();
36
+
37
+ var _soundActions = _slicedToArray(soundActions, 1),
38
+ playSound = _soundActions[0];
21
39
 
22
40
  var close = function close() {
23
41
  emitEvent({
@@ -25,9 +43,6 @@ var CartelComponent = function CartelComponent(_ref) {
25
43
  });
26
44
  };
27
45
 
28
- var textBox = (0, _react.useRef)();
29
- var picture = (0, _react.useRef)();
30
-
31
46
  var assignValueByMediaQuery = function assignValueByMediaQuery(valueMobile, valueDesktop) {
32
47
  if (window.matchMedia('(min-width: 1280px)').matches) {
33
48
  /* Screen >= 1200 */
@@ -68,8 +83,11 @@ var CartelComponent = function CartelComponent(_ref) {
68
83
  resizeObserver.observe(picture.current);
69
84
  }
70
85
  });
71
- (0, _react.useEffect)(function () {// PLAY SOUND
72
- }, []);
86
+ (0, _react.useEffect)(function () {
87
+ if (audio.url) {
88
+ playSound(audio.url);
89
+ }
90
+ }, [playSound, audio]);
73
91
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
74
92
  className: "cartel"
75
93
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -58,6 +58,10 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
58
58
  setIndex = _useState2[1];
59
59
 
60
60
  var puzzleId = "chained-image-click-puzzle_".concat(index, "_").concat(nodeId);
61
+
62
+ var _soundActions = _slicedToArray(soundActions, 1),
63
+ playSound = _soundActions[0];
64
+
61
65
  var currentPuzzleStatus = (0, _react.useMemo)(function () {
62
66
  return emitEvent({
63
67
  type: 'loadObjectStatus',
@@ -70,11 +74,12 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
70
74
  };
71
75
 
72
76
  var handleFinish = (0, _react.useCallback)(function (rewards) {
77
+ playSound('score');
73
78
  emitEvent({
74
79
  type: 'addPoints',
75
80
  payload: [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(rewards))
76
81
  });
77
- }, [emitEvent]);
82
+ }, [emitEvent, playSound]);
78
83
  var handleResolve = (0, _react.useCallback)(function () {
79
84
  emitEvent({
80
85
  type: 'puzzleAction',
@@ -106,6 +111,7 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
106
111
  }, [index, list.length, selected, currentImageProps.areas.length, handleFinish, handleResolve, setSelected]);
107
112
 
108
113
  var onResolve = function onResolve(resolve) {
114
+ playSound('score');
109
115
  resolve(false);
110
116
  setTimeout(function () {
111
117
  onComplete(info.resolve.rewards || [], false);
@@ -119,7 +125,6 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
119
125
  var timeout;
120
126
 
121
127
  if (currentPuzzleStatus) {
122
- alert('TEST');
123
128
  timeout = setTimeout(function () {
124
129
  onComplete([], false);
125
130
  }, 2000);
@@ -44,7 +44,8 @@ var ConversationalComponent = function ConversationalComponent(_ref) {
44
44
  messages = _ref.messages,
45
45
  characters = _ref.characters,
46
46
  alias = _ref.alias,
47
- background = _ref.background;
47
+ background = _ref.background,
48
+ lodSettings = _ref.lodSettings;
48
49
 
49
50
  var _useState = (0, _react.useState)(0),
50
51
  _useState2 = _slicedToArray(_useState, 2),
@@ -87,6 +88,7 @@ var ConversationalComponent = function ConversationalComponent(_ref) {
87
88
  } : {}
88
89
  }, /*#__PURE__*/_react.default.createElement(_SlotList.default, {
89
90
  characters: parsedCharacters,
91
+ lodSettings: lodSettings,
90
92
  currentMessage: currentMessage,
91
93
  slots: parsedCharacters,
92
94
  flex: true
@@ -48,7 +48,8 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
48
48
  lines = _ref.lines,
49
49
  characters = _ref.characters,
50
50
  background = _ref.background,
51
- soundActions = _ref.soundActions;
51
+ soundActions = _ref.soundActions,
52
+ lodSettings = _ref.lodSettings;
52
53
 
53
54
  var _useState = (0, _react.useState)(0),
54
55
  _useState2 = _slicedToArray(_useState, 2),
@@ -165,6 +166,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
165
166
  var decisionPayload = _objectSpread(_objectSpread({}, currentLineData.payload), {}, {
166
167
  onFinish: handleClickNext,
167
168
  emitEvent: emitEvent,
169
+ soundActions: soundActions,
168
170
  inheritProps: {
169
171
  characters: characters,
170
172
  background: backgroundImage,
@@ -185,7 +187,8 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
185
187
  backgroundImage: "url(\"".concat(backgroundImage, "\")")
186
188
  } : {}
187
189
  }, /*#__PURE__*/_react.default.createElement(_SlotList.default, _extends({}, listProps, {
188
- characters: characters
190
+ characters: characters,
191
+ lodSettings: lodSettings
189
192
  })), /*#__PURE__*/_react.default.createElement("div", {
190
193
  className: "conversation--body"
191
194
  }, currentMessage ? /*#__PURE__*/_react.default.createElement(_Message.default, {
@@ -19,6 +19,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
19
19
 
20
20
  var SlotList = function SlotList(_ref) {
21
21
  var characters = _ref.characters,
22
+ lodSettings = _ref.lodSettings,
22
23
  currentMessage = _ref.currentMessage,
23
24
  flex = _ref.flex,
24
25
  slots = _ref.slots,
@@ -86,7 +87,8 @@ var SlotList = function SlotList(_ref) {
86
87
  characters: currentChars,
87
88
  slots: slots,
88
89
  flex: flex,
89
- currentMessage: currentMessage
90
+ currentMessage: currentMessage,
91
+ lodSettings: lodSettings
90
92
  }), children && children.ref ? children : /*#__PURE__*/_react.default.createElement(Slots, null));
91
93
  };
92
94
 
@@ -35,7 +35,8 @@ function Panel(_ref) {
35
35
  var _character$resource, _character$resource$a;
36
36
 
37
37
  var character = _ref.character,
38
- active = _ref.active;
38
+ active = _ref.active,
39
+ lodSettings = _ref.lodSettings;
39
40
  var cameraRef = (0, _react.useRef)(null);
40
41
  var sceneRef = (0, _react.useRef)(null);
41
42
  var isCharacter = character.type === 'character';
@@ -58,9 +59,9 @@ function Panel(_ref) {
58
59
  }
59
60
 
60
61
  cameraRef.current.updateProjectionMatrix();
61
- (0, _drawLOD.default)(sceneRef.current, cameraRef.current);
62
+ (0, _drawLOD.default)(sceneRef.current, cameraRef.current, lodSettings);
62
63
  }
63
- }, [character]);
64
+ }, [character, lodSettings]);
64
65
  (0, _fiber.useFrame)(function (_ref2) {
65
66
  var gl = _ref2.gl;
66
67
 
@@ -15,7 +15,8 @@ var Panels = function Panels(_ref) {
15
15
  var characters = _ref.characters,
16
16
  slots = _ref.slots,
17
17
  activeIndex = _ref.activeIndex,
18
- flex = _ref.flex;
18
+ flex = _ref.flex,
19
+ lodSettings = _ref.lodSettings;
19
20
  return characters.map(function (char, index) {
20
21
  var notFlexedPosition = slots.findIndex(function (s) {
21
22
  return s.uid === char.uid;
@@ -26,7 +27,8 @@ var Panels = function Panels(_ref) {
26
27
  return /*#__PURE__*/_react.default.createElement(_Panel.default, {
27
28
  key: index,
28
29
  character: char,
29
- active: activeIndex === currentSlot
30
+ active: activeIndex === currentSlot,
31
+ lodSettings: lodSettings
30
32
  });
31
33
  });
32
34
  };
@@ -38,7 +38,8 @@ function Renderer(_ref) {
38
38
  slots = _ref.slots,
39
39
  slotRefs = _ref.slotRefs,
40
40
  flex = _ref.flex,
41
- currentMessage = _ref.currentMessage;
41
+ currentMessage = _ref.currentMessage,
42
+ lodSettings = _ref.lodSettings;
42
43
 
43
44
  var _useState = (0, _react.useState)(),
44
45
  _useState2 = _slicedToArray(_useState, 2),
@@ -59,7 +60,8 @@ function Renderer(_ref) {
59
60
  slots: slots,
60
61
  slotRefs: slotRefs,
61
62
  flex: flex,
62
- activeIndex: currentMessage.position
63
+ activeIndex: currentMessage.position,
64
+ lodSettings: lodSettings
63
65
  }) : null;
64
66
  }
65
67