@realsee/vreo 2.4.7 → 2.5.0-alpha.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.
Files changed (132) hide show
  1. package/README.md +1 -1
  2. package/docs/assets/navigation.js +1 -1
  3. package/docs/assets/search.js +1 -1
  4. package/docs/classes/Player.AudioLike.html +2 -2
  5. package/docs/classes/Player.Controller.html +52 -4
  6. package/docs/classes/Player.Player.html +43 -2
  7. package/docs/classes/Player.VideoAgentMesh.html +61 -4
  8. package/docs/classes/Player.VideoAgentScene.html +2 -2
  9. package/docs/demo/assets/{examples-5qw3pq5z.js → examples-DfiAz2fR.js} +1 -1
  10. package/docs/demo/assets/react-BnzBLum3.css +1 -0
  11. package/docs/demo/examples.html +1 -1
  12. package/docs/demo/index-react.html +2 -2
  13. package/docs/demo/index.html +1 -1
  14. package/docs/enums/Player.InfoPanelStyleEnum.html +2 -2
  15. package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
  16. package/docs/enums/Player.PanoEffectEnum.html +2 -2
  17. package/docs/enums/Player.PanoTagEnum.html +2 -2
  18. package/docs/enums/Player.PanoTagStyleEnum.html +3 -3
  19. package/docs/enums/Player.VreoKeyframeEnum.html +13 -13
  20. package/docs/enums/fivePlugins.CameraMovementEffect.html +2 -2
  21. package/docs/enums/fivePlugins.Rotation.html +2 -2
  22. package/docs/functions/custom.SpatialScenePanel.html +1 -1
  23. package/docs/functions/react.useVreoAction.html +8 -1
  24. package/docs/functions/react.useVreoEventCallback.html +10 -1
  25. package/docs/functions/react.useVreoPausedState.html +8 -1
  26. package/docs/index.html +1 -1
  27. package/docs/interfaces/Player.Appearance.html +2 -0
  28. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +2 -2
  29. package/docs/interfaces/Player.PlayerConfigs.html +6 -6
  30. package/docs/interfaces/Player.Vertex.html +2 -2
  31. package/docs/interfaces/Player.VideoAgentMeshOptions.html +5 -4
  32. package/docs/interfaces/Player.VreoKeyframe.html +2 -2
  33. package/docs/interfaces/Player.VreoUnit.html +2 -2
  34. package/docs/interfaces/Player.VreoVideo.html +2 -2
  35. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +7 -5
  36. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +2 -2
  37. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +3 -3
  38. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
  39. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +2 -2
  40. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +2 -2
  41. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +2 -2
  42. package/docs/interfaces/fivePlugins.Vector3Position.html +2 -2
  43. package/docs/interfaces/react.VreoActionCallbacks.html +7 -7
  44. package/docs/interfaces/react.VreoProviderProps.html +5 -2
  45. package/docs/modules/Player.html +1 -1
  46. package/docs/modules/fivePlugins.html +1 -1
  47. package/docs/types/Player.AppSize.html +1 -0
  48. package/docs/types/Player.AudioLikeEvent.html +2 -2
  49. package/docs/types/Player.CameraMovementData.html +1 -1
  50. package/docs/types/Player.CustomData.html +1 -1
  51. package/docs/types/Player.InfoPanelData.html +2 -2
  52. package/docs/types/Player.ModelVideoData.html +5 -5
  53. package/docs/types/Player.PanoEffectData.html +2 -2
  54. package/docs/types/Player.PanoTagData.html +2 -2
  55. package/docs/types/Player.PanoTextLabelData.html +2 -2
  56. package/docs/types/Player.PrompterData.html +2 -2
  57. package/docs/types/Player.QuadrangleVertexs.html +1 -1
  58. package/docs/types/Player.Quaternion.html +2 -2
  59. package/docs/types/Player.UpdateVRPanoramaData.html +2 -2
  60. package/docs/types/Player.Vertexs.html +1 -1
  61. package/docs/types/Player.VideoEffectData.html +2 -2
  62. package/docs/types/Player.VreoKeyframeEvent.html +1 -1
  63. package/docs/types/Player.VreoKeyframeMap.html +2 -2
  64. package/docs/types/Player.VreoSubscribe.html +1 -1
  65. package/docs/types/Player.WaveAppearance.html +1 -0
  66. package/docs/types/fivePlugins.CSS3DRenderPluginParameterType.html +1 -0
  67. package/docs/types/fivePlugins.MoveArgs.html +1 -1
  68. package/docs/types/fivePlugins.MoveOpts.html +1 -1
  69. package/docs/types/fivePlugins.RotateArgs.html +1 -1
  70. package/docs/types/fivePlugins.RotateOpts.html +1 -1
  71. package/docs/variables/fivePlugins.CSS3DRenderPlugin.html +2 -2
  72. package/docs/variables/fivePlugins.CameraMovementPlugin.html +1 -1
  73. package/docs/variables/fivePlugins.ModelTVVideoPlugin.html +1 -1
  74. package/docs/variables/react.VreoProvider.html +9 -1
  75. package/lib/PlayController/createHTMLAudioElement.js +5 -12
  76. package/lib/PlayController/index.js +27 -34
  77. package/lib/Player/App.js +25 -34
  78. package/lib/Player/Controller.d.ts +106 -2
  79. package/lib/Player/Controller.js +190 -78
  80. package/lib/Player/custom/SpatialScenePanel/index.js +20 -31
  81. package/lib/Player/hooks.js +6 -15
  82. package/lib/Player/index.d.ts +103 -0
  83. package/lib/Player/index.js +153 -45
  84. package/lib/Player/modules/Drawer/index.js +8 -17
  85. package/lib/Player/modules/PopUp/index.js +8 -17
  86. package/lib/Player/modules/ResizeObserver/index.js +10 -17
  87. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +108 -7
  88. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +157 -52
  89. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +16 -25
  90. package/lib/Player/modules/VideoAgent/index.js +8 -17
  91. package/lib/Player/modules/Wave/index.js +24 -33
  92. package/lib/Player/modules/keyframes/BgMusic/index.js +13 -22
  93. package/lib/Player/modules/keyframes/CameraMovement/index.js +17 -26
  94. package/lib/Player/modules/keyframes/InfoPanel/index.js +13 -21
  95. package/lib/Player/modules/keyframes/ModelVideo/index.js +17 -26
  96. package/lib/Player/modules/keyframes/PanoEffect/index.js +21 -30
  97. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +6 -14
  98. package/lib/Player/modules/keyframes/PanoTag/index.js +10 -18
  99. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +19 -28
  100. package/lib/Player/modules/keyframes/Prompter/index.js +13 -22
  101. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +16 -24
  102. package/lib/Player/modules/keyframes/VideoEffect/index.js +18 -28
  103. package/lib/Player/typings.js +1 -5
  104. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +3 -9
  105. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -7
  106. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -7
  107. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +6 -12
  108. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +27 -37
  109. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +3 -9
  110. package/lib/fivePlugins/CameraMovementPlugin/index.js +15 -22
  111. package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -10
  112. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +9 -18
  113. package/lib/index.js +1 -12
  114. package/lib/react/index.d.ts +111 -0
  115. package/lib/react/index.js +148 -24
  116. package/lib/shared-utils/Audio.js +27 -37
  117. package/lib/shared-utils/AudioLike.js +22 -29
  118. package/lib/shared-utils/Preloader.js +1 -7
  119. package/lib/shared-utils/addResizeListener.js +4 -11
  120. package/lib/shared-utils/animationFrame/BetterTween.js +23 -33
  121. package/lib/shared-utils/animationFrame/index.js +4 -13
  122. package/lib/shared-utils/animationFrame/tween.js +9 -17
  123. package/lib/shared-utils/createTransMatrix.js +5 -14
  124. package/lib/shared-utils/getFileExpandedName.js +1 -7
  125. package/lib/shared-utils/getMediaInfo.js +8 -19
  126. package/lib/shared-utils/setElementDataset.js +1 -7
  127. package/lib/typings/VreoUnit.js +15 -17
  128. package/package.json +58 -5
  129. package/stylesheets/custom/SpatialScenePanel.css +7 -7
  130. package/stylesheets/default.css +1 -1
  131. package/docs/demo/assets/react-dPVEotm3.css +0 -1
  132. /package/docs/demo/assets/{react-BLZb_LNZ.js → react-C4h9qndP.js} +0 -0
@@ -1,14 +1,5 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Wave = Wave;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useState, useCallback, useRef, useEffect } from 'react';
12
3
  var defaultPrefix = 'https://vr-public.realsee-cdn.cn/release/static/image/release/';
13
4
  var WAVES = {
14
5
  single: {
@@ -19,7 +10,7 @@ var WAVES = {
19
10
  vp9: 'vapor/static/wave-single.eda65de390a830193fff40d1f1255555.webm',
20
11
  png: 'vapor/static/wave-single.f51aade2a6e1c59211698a1a24e6135f.png'
21
12
  },
22
- "double": {
13
+ double: {
23
14
  width: 766,
24
15
  height: 60,
25
16
  frames: 16,
@@ -58,49 +49,49 @@ var isSafari = /safari/i.test(userAgent) && !/chrome/i.test(userAgent) && /versi
58
49
  var isMicroMessenger = /microMessenger/i.test(userAgent);
59
50
  var canPlayHevc = isAppleDevice || isSafari;
60
51
  var canPlayVp9 = typeof MediaSource !== 'undefined' && MediaSource.isTypeSupported("video/webm; codecs=vp9");
61
- function Wave(props) {
62
- var wave = _react["default"].useMemo(function () {
52
+ export function Wave(props) {
53
+ var wave = React.useMemo(function () {
63
54
  var _props$appearance;
64
55
  var appearance = (_props$appearance = props === null || props === void 0 ? void 0 : props.appearance) !== null && _props$appearance !== void 0 ? _props$appearance : 'solid';
65
56
  return WAVES[appearance];
66
57
  }, [props === null || props === void 0 ? void 0 : props.appearance]);
67
- var heightWidthRatio = _react["default"].useMemo(function () {
58
+ var heightWidthRatio = React.useMemo(function () {
68
59
  return wave.height / wave.width;
69
60
  }, [wave]);
70
61
  var content = null;
71
62
  if (isMicroMessenger) {
72
- content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
63
+ content = /*#__PURE__*/React.createElement(KeyframeWaveContent, {
73
64
  wave: wave,
74
65
  prefix: props === null || props === void 0 ? void 0 : props.staticPrefix
75
66
  });
76
67
  } else if (canPlayHevc) {
77
- content = /*#__PURE__*/_react["default"].createElement(VideoWaveContent, {
68
+ content = /*#__PURE__*/React.createElement(VideoWaveContent, {
78
69
  format: "hevc",
79
70
  wave: wave,
80
71
  prefix: props === null || props === void 0 ? void 0 : props.staticPrefix
81
72
  });
82
73
  } else if (canPlayVp9) {
83
- content = /*#__PURE__*/_react["default"].createElement(VideoWaveContent, {
74
+ content = /*#__PURE__*/React.createElement(VideoWaveContent, {
84
75
  format: "vp9",
85
76
  wave: wave,
86
77
  prefix: props === null || props === void 0 ? void 0 : props.staticPrefix
87
78
  });
88
79
  } else {
89
- content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
80
+ content = /*#__PURE__*/React.createElement(KeyframeWaveContent, {
90
81
  wave: wave,
91
82
  prefix: props === null || props === void 0 ? void 0 : props.staticPrefix
92
83
  });
93
84
  }
94
- return /*#__PURE__*/_react["default"].createElement("div", {
85
+ return /*#__PURE__*/React.createElement("div", {
95
86
  className: "vreo-wave",
96
87
  onClick: props === null || props === void 0 ? void 0 : props.onClick
97
- }, /*#__PURE__*/_react["default"].createElement("div", {
88
+ }, /*#__PURE__*/React.createElement("div", {
98
89
  style: {
99
90
  position: 'relative',
100
91
  width: '100%',
101
92
  paddingTop: "".concat(heightWidthRatio * 100, "%")
102
93
  }
103
- }, /*#__PURE__*/_react["default"].createElement("div", {
94
+ }, /*#__PURE__*/React.createElement("div", {
104
95
  style: {
105
96
  position: 'absolute',
106
97
  width: '100%',
@@ -115,35 +106,35 @@ var VideoWaveContent = function VideoWaveContent(_ref) {
115
106
  format = _ref.format,
116
107
  _ref$prefix = _ref.prefix,
117
108
  prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
118
- var videoRef = (0, _react.useRef)(null);
119
- var _useState = (0, _react.useState)(false),
120
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
109
+ var videoRef = useRef(null);
110
+ var _useState = useState(false),
111
+ _useState2 = _slicedToArray(_useState, 2),
121
112
  canPlay = _useState2[0],
122
113
  setCanPlay = _useState2[1];
123
- var _useState3 = (0, _react.useState)(false),
124
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
114
+ var _useState3 = useState(false),
115
+ _useState4 = _slicedToArray(_useState3, 2),
125
116
  errored = _useState4[0],
126
117
  setErrored = _useState4[1];
127
118
  var source = prefix + wave[format];
128
- (0, _react.useEffect)(function () {
119
+ useEffect(function () {
129
120
  setCanPlay(false);
130
121
  }, [source]);
131
- var canPlayHandler = (0, _react.useCallback)(function () {
122
+ var canPlayHandler = useCallback(function () {
132
123
  if (videoRef.current) {
133
124
  videoRef.current.play();
134
125
  }
135
126
  setCanPlay(true);
136
127
  }, []);
137
- var errorHandler = (0, _react.useCallback)(function () {
128
+ var errorHandler = useCallback(function () {
138
129
  setErrored(true);
139
130
  }, []);
140
131
  if (errored) {
141
- return /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
132
+ return /*#__PURE__*/React.createElement(KeyframeWaveContent, {
142
133
  wave: wave,
143
134
  prefix: prefix
144
135
  });
145
136
  }
146
- return /*#__PURE__*/_react["default"].createElement("video", {
137
+ return /*#__PURE__*/React.createElement("video", {
147
138
  style: {
148
139
  opacity: canPlay ? 1 : 0
149
140
  },
@@ -165,7 +156,7 @@ var KeyframeWaveContent = function KeyframeWaveContent(_ref2) {
165
156
  _ref2$prefix = _ref2.prefix,
166
157
  prefix = _ref2$prefix === void 0 ? defaultPrefix : _ref2$prefix;
167
158
  var source = prefix + wave.png;
168
- return /*#__PURE__*/_react["default"].createElement("div", {
159
+ return /*#__PURE__*/React.createElement("div", {
169
160
  style: {
170
161
  width: "100%",
171
162
  height: "100%",
@@ -1,25 +1,16 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.BgMusic = BgMusic;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var React = _interopRequireWildcard(require("react"));
12
- var _Audio = require("../../../../shared-utils/Audio");
13
- var _VreoUnit = require("../../../../typings/VreoUnit");
14
- var _hooks = require("../../../hooks");
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
16
- function BgMusic() {
17
- var controller = (0, _hooks.useController)();
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import * as React from 'react';
4
+ import { getAudio } from "../../../../shared-utils/Audio.js";
5
+ import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
6
+ import { useController } from "../../../hooks.js";
7
+ export function BgMusic() {
8
+ var controller = useController();
18
9
  React.useEffect(function () {
19
10
  var callback = /*#__PURE__*/function () {
20
- var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(keyframe, currentTime) {
11
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyframe, currentTime) {
21
12
  var start, end, _currentTime, audio, cleanAudio, play;
22
- return _regenerator["default"].wrap(function _callee$(_context) {
13
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
23
14
  while (1) {
24
15
  switch (_context.prev = _context.next) {
25
16
  case 0:
@@ -31,7 +22,7 @@ function BgMusic() {
31
22
  }
32
23
  return _context.abrupt("return");
33
24
  case 4:
34
- audio = (0, _Audio.getAudio)(keyframe.data.url);
25
+ audio = getAudio(keyframe.data.url);
35
26
  audio.currentTime = Math.max(0, _currentTime);
36
27
  // console.log('play', audio.src)
37
28
  // const play = () => audio.play()
@@ -69,9 +60,9 @@ function BgMusic() {
69
60
  return _ref.apply(this, arguments);
70
61
  };
71
62
  }();
72
- controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
63
+ controller.on(VreoKeyframeEnum.BgMusic, callback);
73
64
  return function () {
74
- controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
65
+ controller.off(VreoKeyframeEnum.BgMusic, callback);
75
66
  };
76
67
  });
77
68
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -1,38 +1,29 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.CameraMovement = CameraMovement;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var React = _interopRequireWildcard(require("react"));
12
- var _CameraMovementPlugin = require("../../../../fivePlugins/CameraMovementPlugin");
13
- var _typings = require("../../../../fivePlugins/CameraMovementPlugin/typings");
14
- var _VreoUnit = require("../../../../typings/VreoUnit");
15
- var _hooks = require("../../../hooks");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
17
- function CameraMovement() {
18
- var controller = (0, _hooks.useController)();
19
- var five = (0, _hooks.useFiveInstance)();
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import * as React from 'react';
4
+ import { CameraMovementPlugin } from "../../../../fivePlugins/CameraMovementPlugin/index.js";
5
+ import { CameraMovementEffect } from "../../../../fivePlugins/CameraMovementPlugin/typings.js";
6
+ import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
7
+ import { useController, useFiveInstance } from "../../../hooks.js";
8
+ export function CameraMovement() {
9
+ var controller = useController();
10
+ var five = useFiveInstance();
20
11
  var ref = React.useRef();
21
12
  React.useEffect(function () {
22
13
  var callback = /*#__PURE__*/function () {
23
- var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(keyframe) {
14
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyframe) {
24
15
  var start, end, data, cameraMovementData, effect;
25
- return _regenerator["default"].wrap(function _callee$(_context) {
16
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
26
17
  while (1) {
27
18
  switch (_context.prev = _context.next) {
28
19
  case 0:
29
20
  if (!ref.current) {
30
- ref.current = (0, _CameraMovementPlugin.CameraMovementPlugin)(five, {});
21
+ ref.current = CameraMovementPlugin(five, {});
31
22
  }
32
23
  start = keyframe.start, end = keyframe.end, data = keyframe.data;
33
24
  cameraMovementData = data;
34
25
  effect = cameraMovementData.effect;
35
- if (!(effect === _typings.CameraMovementEffect.Rotate)) {
26
+ if (!(effect === CameraMovementEffect.Rotate)) {
36
27
  _context.next = 9;
37
28
  break;
38
29
  }
@@ -42,7 +33,7 @@ function CameraMovement() {
42
33
  _context.next = 21;
43
34
  break;
44
35
  case 9:
45
- if (!(effect === _typings.CameraMovementEffect.Move)) {
36
+ if (!(effect === CameraMovementEffect.Move)) {
46
37
  _context.next = 14;
47
38
  break;
48
39
  }
@@ -75,9 +66,9 @@ function CameraMovement() {
75
66
  return _ref.apply(this, arguments);
76
67
  };
77
68
  }();
78
- controller.on(_VreoUnit.VreoKeyframeEnum.CameraMovement, callback);
69
+ controller.on(VreoKeyframeEnum.CameraMovement, callback);
79
70
  return function () {
80
- controller.off(_VreoUnit.VreoKeyframeEnum.CameraMovement, callback);
71
+ controller.off(VreoKeyframeEnum.CameraMovement, callback);
81
72
  };
82
73
  }, [controller]);
83
74
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -1,14 +1,6 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.InfoPanel = InfoPanel;
8
- var React = _interopRequireWildcard(require("react"));
9
- var _VreoUnit = require("../../../../typings/VreoUnit");
10
- var _hooks = require("../../../hooks");
11
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
1
+ import * as React from 'react';
2
+ import { InfoPanelStyleEnum, InfoPanelTypeEnum, VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
3
+ import { useController } from "../../../hooks.js";
12
4
  var isWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1;
13
5
  var isIOS = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
14
6
  var isIOSorWX = isIOS || isWX;
@@ -39,7 +31,7 @@ function InfoPanelVideo(_ref2) {
39
31
  var url = _ref2.url,
40
32
  children = _ref2.children;
41
33
  var videoWrapperRef = React.useRef(null);
42
- var controller = (0, _hooks.useController)();
34
+ var controller = useController();
43
35
  React.useEffect(function () {
44
36
  var _controller$configs, _controller$configs$v;
45
37
  // if (!isIOSorWX) return
@@ -88,9 +80,9 @@ var Title = function Title(props) {
88
80
  className: "vreo-infoPanel-t2"
89
81
  }, props.subTitle)));
90
82
  };
91
- function InfoPanel() {
83
+ export function InfoPanel() {
92
84
  var timeoutRef = React.useRef();
93
- var controller = (0, _hooks.useController)();
85
+ var controller = useController();
94
86
  React.useEffect(function () {
95
87
  var _controller$configs2;
96
88
  if (((_controller$configs2 = controller.configs) === null || _controller$configs2 === void 0 ? void 0 : _controller$configs2.keyframeMap.InfoPanel) === false) {
@@ -105,15 +97,15 @@ function InfoPanel() {
105
97
  subTitle = infoPanelData.subTitle,
106
98
  style = infoPanelData.style;
107
99
  do {
108
- if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
109
- if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
100
+ if (style === InfoPanelStyleEnum.PopUp) {
101
+ if (infoPanelData.type === InfoPanelTypeEnum.Image) {
110
102
  controller.openPopUp(/*#__PURE__*/React.createElement(InfoPanelImg, {
111
103
  url: infoPanelData.url
112
104
  }, /*#__PURE__*/React.createElement(Title, {
113
105
  title: title,
114
106
  subTitle: subTitle
115
107
  })));
116
- } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
108
+ } else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
117
109
  controller.openPopUp(/*#__PURE__*/React.createElement(InfoPanelVideo, {
118
110
  url: infoPanelData.url
119
111
  }, /*#__PURE__*/React.createElement(Title, {
@@ -123,7 +115,7 @@ function InfoPanel() {
123
115
  }
124
116
  break;
125
117
  }
126
- if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
118
+ if (infoPanelData.type === InfoPanelTypeEnum.Image) {
127
119
  controller.openDrawer({
128
120
  content: /*#__PURE__*/React.createElement(InfoPanelImg, {
129
121
  url: infoPanelData.url
@@ -133,7 +125,7 @@ function InfoPanel() {
133
125
  })),
134
126
  height: '60vh'
135
127
  });
136
- } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
128
+ } else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
137
129
  controller.openDrawer({
138
130
  content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
139
131
  url: infoPanelData.url
@@ -150,7 +142,7 @@ function InfoPanel() {
150
142
  controller.openPopUp(false);
151
143
  }, end - start);
152
144
  };
153
- controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
145
+ controller.on(VreoKeyframeEnum.InfoPanel, callback);
154
146
  controller.on('ended', function () {
155
147
  controller.openPopUp(false);
156
148
  });
@@ -158,7 +150,7 @@ function InfoPanel() {
158
150
  controller.openPopUp(false);
159
151
  });
160
152
  return function () {
161
- controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
153
+ controller.off(VreoKeyframeEnum.InfoPanel, callback);
162
154
  if (timeoutRef.current) {
163
155
  clearTimeout(timeoutRef.current);
164
156
  }
@@ -1,36 +1,27 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.ModelVideo = ModelVideo;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var React = _interopRequireWildcard(require("react"));
12
- var THREE = _interopRequireWildcard(require("three"));
13
- var _hooks = require("../../../hooks");
14
- var _ModelTVVideoPlugin = require("../../../../fivePlugins/ModelTVVideoPlugin");
15
- var _createTransMatrix = require("../../../../shared-utils/createTransMatrix");
16
- var _VreoUnit = require("../../../../typings/VreoUnit");
17
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
18
- function ModelVideo() {
19
- var controller = (0, _hooks.useController)();
20
- var five = (0, _hooks.useFiveInstance)();
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import * as React from 'react';
4
+ import * as THREE from 'three';
5
+ import { useController, useFiveInstance } from "../../../hooks.js";
6
+ import { ModelTVVideoPlugin } from "../../../../fivePlugins/ModelTVVideoPlugin/index.js";
7
+ import { createTransMatrix } from "../../../../shared-utils/createTransMatrix.js";
8
+ import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
9
+ export function ModelVideo() {
10
+ var controller = useController();
11
+ var five = useFiveInstance();
21
12
  var ref = React.useRef();
22
13
  var timeoutRef = React.useRef();
23
14
  React.useEffect(function () {
24
15
  var callback = /*#__PURE__*/function () {
25
- var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(keyframe) {
16
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyframe) {
26
17
  var _controller$configs, _controller$configs$v;
27
18
  var start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points;
28
- return _regenerator["default"].wrap(function _callee$(_context) {
19
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
29
20
  while (1) {
30
21
  switch (_context.prev = _context.next) {
31
22
  case 0:
32
23
  if (!ref.current) {
33
- ref.current = (0, _ModelTVVideoPlugin.ModelTVVideoPlugin)(five, {});
24
+ ref.current = ModelTVVideoPlugin(five, {});
34
25
  }
35
26
  start = keyframe.start, end = keyframe.end;
36
27
  _ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
@@ -49,7 +40,7 @@ function ModelVideo() {
49
40
  }();
50
41
  points = function () {
51
42
  if (matrixWorld) {
52
- var transMatrix = (0, _createTransMatrix.createTransMatrix)(matrixWorld);
43
+ var transMatrix = createTransMatrix(matrixWorld);
53
44
  return [position.map(function (p) {
54
45
  var res = transMatrix([p.x, p.y, p.z]);
55
46
  return {
@@ -85,9 +76,9 @@ function ModelVideo() {
85
76
  return _ref.apply(this, arguments);
86
77
  };
87
78
  }();
88
- controller.on(_VreoUnit.VreoKeyframeEnum.ModelVideo, callback);
79
+ controller.on(VreoKeyframeEnum.ModelVideo, callback);
89
80
  return function () {
90
- controller.off(_VreoUnit.VreoKeyframeEnum.ModelVideo, callback);
81
+ controller.off(VreoKeyframeEnum.ModelVideo, callback);
91
82
  if (timeoutRef.current) {
92
83
  clearTimeout(timeoutRef.current);
93
84
  }
@@ -1,33 +1,24 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.PanoEffect = PanoEffect;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var React = _interopRequireWildcard(require("react"));
11
- var _three = require("three");
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
- var _lineAnime = _interopRequireDefault(require("./lineAnime"));
14
- var _hooks = require("../../../hooks");
15
- var _VreoUnit = require("../../../../typings/VreoUnit");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
17
- function PanoEffect() {
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import * as React from 'react';
3
+ import { Vector3 } from 'three';
4
+ import classNames from 'classnames';
5
+ import lineAnime from "./lineAnime.js";
6
+ import { useController, useFiveInstance, useFiveProject2d } from "../../../hooks.js";
7
+ import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
8
+ export function PanoEffect() {
18
9
  var _React$useState = React.useState(null),
19
- _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
10
+ _React$useState2 = _slicedToArray(_React$useState, 2),
20
11
  state = _React$useState2[0],
21
12
  setState = _React$useState2[1];
22
- var five = (0, _hooks.useFiveInstance)();
13
+ var five = useFiveInstance();
23
14
  var lineRef = React.useRef(null);
24
15
  var _React$useState3 = React.useState(null),
25
- _React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
16
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
26
17
  pos = _React$useState4[0],
27
18
  setPos = _React$useState4[1];
28
19
  var timeoutRef = React.useRef();
29
- var controller = (0, _hooks.useController)();
30
- var project2d = (0, _hooks.useFiveProject2d)();
20
+ var controller = useController();
21
+ var project2d = useFiveProject2d();
31
22
  var delLine = function delLine() {
32
23
  if (lineRef.current) {
33
24
  lineRef.current.dispose();
@@ -39,12 +30,12 @@ function PanoEffect() {
39
30
  end = keyframe.end,
40
31
  data = keyframe.data;
41
32
  var videoEffectData = data;
42
- var _videoEffectData$twoV = (0, _slicedToArray2["default"])(videoEffectData.twoVertexs, 2),
33
+ var _videoEffectData$twoV = _slicedToArray(videoEffectData.twoVertexs, 2),
43
34
  v1 = _videoEffectData$twoV[0],
44
35
  v2 = _videoEffectData$twoV[1];
45
- var p1 = new _three.Vector3(v1.x, v1.y, v1.z);
46
- var p2 = new _three.Vector3(v2.x, v2.y, v2.z);
47
- lineRef.current = (0, _lineAnime["default"])(five, p1.clone(), p2.clone());
36
+ var p1 = new Vector3(v1.x, v1.y, v1.z);
37
+ var p2 = new Vector3(v2.x, v2.y, v2.z);
38
+ lineRef.current = lineAnime(five, p1.clone(), p2.clone());
48
39
  lineRef.current.play();
49
40
  var center = p1.lerp(p2, 0.5);
50
41
  var distance = p1.distanceTo(p2);
@@ -66,9 +57,9 @@ function PanoEffect() {
66
57
  delLine();
67
58
  }, end - start);
68
59
  };
69
- controller.on(_VreoUnit.VreoKeyframeEnum.PanoEffect, callback);
60
+ controller.on(VreoKeyframeEnum.PanoEffect, callback);
70
61
  return function () {
71
- controller.off(_VreoUnit.VreoKeyframeEnum.PanoEffect, callback);
62
+ controller.off(VreoKeyframeEnum.PanoEffect, callback);
72
63
  if (timeoutRef.current) {
73
64
  clearTimeout(timeoutRef.current);
74
65
  }
@@ -82,7 +73,7 @@ function PanoEffect() {
82
73
  x = _state$center.x,
83
74
  y = _state$center.y,
84
75
  z = _state$center.z;
85
- var res = project2d(new _three.Vector3(x, y, z));
76
+ var res = project2d(new Vector3(x, y, z));
86
77
  if (!res) return;
87
78
  var left = res.x,
88
79
  top = res.y;
@@ -97,7 +88,7 @@ function PanoEffect() {
97
88
  };
98
89
  }, [state === null || state === void 0 ? void 0 : state.center]);
99
90
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
100
- className: (0, _classnames["default"])('PanoEffect', {
91
+ className: classNames('PanoEffect', {
101
92
  'PanoEffect--notHidden': state
102
93
  }),
103
94
  style: {
@@ -1,19 +1,11 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = lineAnime;
8
- var THREE = _interopRequireWildcard(require("three"));
9
- var _line = require("@realsee/five/line");
10
- var _BetterTween = require("../../../../shared-utils/animationFrame/BetterTween");
11
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
12
- function lineAnime(five, startPoint, endPoint) {
1
+ import * as THREE from 'three';
2
+ import { Line as FiveLine } from '@realsee/five/line';
3
+ import { tweenProgress } from "../../../../shared-utils/animationFrame/BetterTween.js";
4
+ export default function lineAnime(five, startPoint, endPoint) {
13
5
  var pointImage = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==';
14
6
  var pointTexture = new THREE.TextureLoader().load(pointImage);
15
7
  var color = new THREE.Color(0xffffff);
16
- var line = new _line.Line();
8
+ var line = new FiveLine();
17
9
  line.setMaterial({
18
10
  linewidth: 2,
19
11
  color: color
@@ -22,7 +14,7 @@ function lineAnime(five, startPoint, endPoint) {
22
14
  pointMaterial.map = pointTexture;
23
15
  pointMaterial.color.set(color);
24
16
  line.line.material.depthTest = false;
25
- return (0, _BetterTween.tweenProgress)().onUpdate(function (_ref) {
17
+ return tweenProgress().onUpdate(function (_ref) {
26
18
  var progress = _ref.progress;
27
19
  var lerpLeft = 0.5 - progress / 2;
28
20
  var lerpRight = 0.5 + progress / 2;
@@ -1,20 +1,12 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.PanoTag = PanoTag;
8
- var React = _interopRequireWildcard(require("react"));
9
- var _hooks = require("../../../hooks");
10
- var _VreoUnit = require("../../../../typings/VreoUnit");
11
- var _dnalogel = require("@realsee/dnalogel");
12
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
13
- function PanoTag() {
1
+ import * as React from 'react';
2
+ import { useController, useFiveInstance } from "../../../hooks.js";
3
+ import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
4
+ import { PanoTagPlugin } from '@realsee/dnalogel';
5
+ export function PanoTag() {
14
6
  var timeoutRef = React.useRef();
15
- var controller = (0, _hooks.useController)();
16
- var five = (0, _hooks.useFiveInstance)();
17
- var panoTagPlugin = React.useRef((0, _dnalogel.PanoTagPlugin)(five, {
7
+ var controller = useController();
8
+ var five = useFiveInstance();
9
+ var panoTagPlugin = React.useRef(PanoTagPlugin(five, {
18
10
  config: {
19
11
  globalConfig: {
20
12
  visibleConfig: {
@@ -104,9 +96,9 @@ function PanoTag() {
104
96
  });
105
97
  }, end - start);
106
98
  };
107
- controller.on(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
99
+ controller.on(VreoKeyframeEnum.PanoTag, callback);
108
100
  return function () {
109
- controller.off(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
101
+ controller.off(VreoKeyframeEnum.PanoTag, callback);
110
102
  if (timeoutRef.current) {
111
103
  clearTimeout(timeoutRef.current);
112
104
  }