@gamelearn/arcade-components 2.15.1 → 2.15.2

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.
@@ -145,6 +145,7 @@ var DialogComponent = function DialogComponent(_ref) {
145
145
  var lastLine = lines[line - 1];
146
146
  var lastSet = (0, _react.useRef)(false);
147
147
  var isBranched = !!edges;
148
+ var onZoomEnd = (0, _react.useRef)(function () {});
148
149
 
149
150
  var _ref2 = currentLineData || {},
150
151
  voiceOver = _ref2.voiceOver,
@@ -302,7 +303,10 @@ var DialogComponent = function DialogComponent(_ref) {
302
303
  var resetCameraView = (0, _react.useCallback)(function () {
303
304
  messagePosition.current.child = null;
304
305
  messagePosition.current.parent = null;
305
- if (zoomInActor) setAnimationRunning(true);
306
+
307
+ if (zoomInActor) {
308
+ setAnimationRunning(true);
309
+ }
306
310
  }, [zoomInActor]);
307
311
 
308
312
  var resetTalkingAnimation = function resetTalkingAnimation() {
@@ -530,6 +534,7 @@ var DialogComponent = function DialogComponent(_ref) {
530
534
 
531
535
  (0, _react.useEffect)(function () {
532
536
  if (isDecision) {
537
+ zoomStarted.current = false;
533
538
  resetCameraView();
534
539
  } else if (isVoiceOver) {
535
540
  resetCameraView();
@@ -592,11 +597,7 @@ var DialogComponent = function DialogComponent(_ref) {
592
597
  var showArrowTop = talkingCharacter.text.length > maxCharacterToSwitch;
593
598
  moveBubble(element, showArrowTop);
594
599
 
595
- if (zoomInActor) {
596
- setAnimationRunning(true);
597
- }
598
-
599
- setTimeout(function () {
600
+ var setMessage = function setMessage() {
600
601
  var _talkingCharacter$cha5;
601
602
 
602
603
  setCurrentMessage({
@@ -607,7 +608,14 @@ var DialogComponent = function DialogComponent(_ref) {
607
608
  avatar: getAvatarURL(talkingCharacter),
608
609
  show: true
609
610
  });
610
- }, zoomInActor ? 1200 : 0);
611
+ };
612
+
613
+ if (zoomInActor) {
614
+ onZoomEnd.current = setMessage;
615
+ setAnimationRunning(true);
616
+ } else {
617
+ setMessage();
618
+ }
611
619
  }
612
620
  });
613
621
  } else {
@@ -697,7 +705,6 @@ var DialogComponent = function DialogComponent(_ref) {
697
705
  }, [currentMessage, nextLine, start, stop, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoPlayCond, audio, voice, audioFailed]);
698
706
  (0, _react.useEffect)(function () {
699
707
  if (animationRunning && !zoomStarted.current) {
700
- zoomStarted.current = true;
701
708
  var cam = camera;
702
709
  var targetPosition = messagePosition.current.child ? messagePosition.current.pos : defaultCamera.position.toArray();
703
710
  animationTarget.current.position.fromArray(targetPosition);
@@ -717,7 +724,14 @@ var DialogComponent = function DialogComponent(_ref) {
717
724
  _gsap.default.to(cam.position, {
718
725
  duration: 1,
719
726
  ease: 'power3.easeInOut',
727
+ onStart: function onStart() {
728
+ zoomStarted.current = true;
729
+ },
720
730
  onComplete: function onComplete() {
731
+ onZoomEnd.current();
732
+
733
+ onZoomEnd.current = function () {};
734
+
721
735
  zoomStarted.current = false;
722
736
  setAnimationRunning(false);
723
737
  raycast.set(cam.getWorldPosition(new _three.Vector3(0, 0, 0)), cam.getWorldDirection(new _three.Vector3()));
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.15.1",
5
+ "version": "2.15.2",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",