@realsee/vreo 2.3.6 → 2.3.8
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.
- package/lib/PlayController/createHTMLAudioElement.js +7 -13
- package/lib/PlayController/index.js +27 -95
- package/lib/Player/App.js +2 -28
- package/lib/Player/Controller.js +48 -132
- package/lib/Player/custom/SpatialScenePanel/index.js +45 -76
- package/lib/Player/hooks.js +1 -11
- package/lib/Player/index.js +34 -101
- package/lib/Player/modules/Drawer/index.js +2 -19
- package/lib/Player/modules/PopUp/index.js +2 -12
- package/lib/Player/modules/ResizeObserver/index.js +1 -9
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +29 -123
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +15 -37
- package/lib/Player/modules/VideoAgent/index.js +2 -19
- package/lib/Player/modules/Wave/index.js +14 -43
- package/lib/Player/modules/keyframes/BgMusic/index.js +10 -28
- package/lib/Player/modules/keyframes/CameraMovement/index.js +6 -30
- package/lib/Player/modules/keyframes/InfoPanel/index.js +9 -39
- package/lib/Player/modules/keyframes/ModelVideo/index.js +6 -32
- package/lib/Player/modules/keyframes/PanoEffect/index.js +19 -52
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -8
- package/lib/Player/modules/keyframes/PanoTag/index.js +5 -23
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +27 -57
- package/lib/Player/modules/keyframes/Prompter/index.js +15 -42
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +19 -26
- package/lib/Player/modules/keyframes/VideoEffect/index.js +18 -59
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +21 -62
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
- package/lib/fivePlugins/CameraMovementPlugin/index.js +20 -74
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +15 -69
- package/lib/index.js +0 -1
- package/lib/react/index.js +10 -41
- package/lib/shared-utils/Audio.js +35 -96
- package/lib/shared-utils/AudioLike.js +20 -56
- package/lib/shared-utils/Preloader.js +0 -7
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.js +19 -58
- package/lib/shared-utils/animationFrame/index.js +2 -10
- package/lib/shared-utils/animationFrame/tween.js +2 -11
- package/lib/shared-utils/createTransMatrix.js +5 -26
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.js +1 -10
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.js +0 -15
- package/package.json +4 -3
|
@@ -1,90 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.AudioLike = void 0;
|
|
9
|
-
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
15
|
var _five = require("@realsee/five");
|
|
11
|
-
|
|
12
16
|
var _animationFrame = require("./animationFrame");
|
|
13
|
-
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
-
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
|
|
20
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
-
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
|
|
24
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
-
|
|
26
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
|
-
|
|
28
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
30
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
|
|
32
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
-
|
|
34
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
|
-
|
|
36
19
|
/**
|
|
37
20
|
* 模拟 `<Audio>` 功能:没有音频,但执行逻辑跟 `<Audio>` 相似。
|
|
38
21
|
*/
|
|
39
22
|
var AudioLike = /*#__PURE__*/function (_Subscribe) {
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
(0, _inherits2["default"])(AudioLike, _Subscribe);
|
|
42
24
|
var _super = _createSuper(AudioLike);
|
|
43
|
-
|
|
44
25
|
function AudioLike() {
|
|
45
26
|
var _this;
|
|
46
|
-
|
|
47
27
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_classCallCheck(this, AudioLike);
|
|
51
|
-
|
|
28
|
+
duration = _ref.duration;
|
|
29
|
+
(0, _classCallCheck2["default"])(this, AudioLike);
|
|
52
30
|
_this = _super.call(this);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "$duration", 0);
|
|
59
|
-
|
|
60
|
-
_defineProperty(_assertThisInitialized(_this), "muted", false);
|
|
61
|
-
|
|
62
|
-
_defineProperty(_assertThisInitialized(_this), "src", '');
|
|
63
|
-
|
|
31
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "$timestamp", null);
|
|
32
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "$currentTime", 0);
|
|
33
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "$duration", 0);
|
|
34
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "muted", false);
|
|
35
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "src", '');
|
|
64
36
|
if (duration) {
|
|
65
37
|
_this.$duration = duration;
|
|
66
38
|
}
|
|
67
|
-
|
|
68
39
|
return _this;
|
|
69
40
|
}
|
|
70
|
-
|
|
71
|
-
_createClass(AudioLike, [{
|
|
41
|
+
(0, _createClass2["default"])(AudioLike, [{
|
|
72
42
|
key: "setAttribute",
|
|
73
|
-
value: function setAttribute(name, value) {
|
|
43
|
+
value: function setAttribute(name, value) {
|
|
44
|
+
// nothing todo
|
|
74
45
|
}
|
|
75
46
|
}, {
|
|
76
47
|
key: "play",
|
|
77
48
|
value: function play() {
|
|
78
49
|
var _this2 = this;
|
|
79
|
-
|
|
80
50
|
if (this.$currentTime === this.$duration) {
|
|
81
51
|
this.$currentTime = 0;
|
|
82
52
|
}
|
|
83
|
-
|
|
84
53
|
if (this.$timestamp === null) {
|
|
85
54
|
this.$timestamp = performance.now();
|
|
86
55
|
}
|
|
87
|
-
|
|
88
56
|
this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
|
|
89
57
|
return _this2.requestAnimationFrameLoop();
|
|
90
58
|
});
|
|
@@ -98,7 +66,6 @@ var AudioLike = /*#__PURE__*/function (_Subscribe) {
|
|
|
98
66
|
this.emit('pause');
|
|
99
67
|
this.stopInterval = undefined;
|
|
100
68
|
}
|
|
101
|
-
|
|
102
69
|
this.$timestamp = null;
|
|
103
70
|
}
|
|
104
71
|
}, {
|
|
@@ -109,7 +76,6 @@ var AudioLike = /*#__PURE__*/function (_Subscribe) {
|
|
|
109
76
|
this.$currentTime += now - this.$timestamp;
|
|
110
77
|
this.$timestamp = now;
|
|
111
78
|
this.emit('timeupdate');
|
|
112
|
-
|
|
113
79
|
if (this.$currentTime >= this.$duration - 10) {
|
|
114
80
|
this.$currentTime = this.$duration;
|
|
115
81
|
this.pause();
|
|
@@ -155,10 +121,8 @@ var AudioLike = /*#__PURE__*/function (_Subscribe) {
|
|
|
155
121
|
this.off(evtName, callback);
|
|
156
122
|
}
|
|
157
123
|
}]);
|
|
158
|
-
|
|
159
124
|
return AudioLike;
|
|
160
125
|
}(_five.Subscribe);
|
|
161
|
-
|
|
162
126
|
exports.AudioLike = AudioLike;
|
|
163
127
|
var _default = AudioLike;
|
|
164
128
|
exports["default"] = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Preloader = void 0;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* 预载器
|
|
10
9
|
*/
|
|
@@ -13,26 +12,21 @@ var Preloader = {
|
|
|
13
12
|
var noop = function noop() {
|
|
14
13
|
return null;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
15
|
return new Promise(function (resolve, reject) {
|
|
18
16
|
var xhr = new XMLHttpRequest();
|
|
19
|
-
|
|
20
17
|
var clear = function clear() {
|
|
21
18
|
xhr.ontimeout = noop;
|
|
22
19
|
xhr.onreadystatechange = noop;
|
|
23
20
|
xhr.onprogress = noop;
|
|
24
21
|
xhr.onabort = noop;
|
|
25
22
|
};
|
|
26
|
-
|
|
27
23
|
xhr.ontimeout = function () {
|
|
28
24
|
reject(new Error('timeout'));
|
|
29
25
|
clear();
|
|
30
26
|
};
|
|
31
|
-
|
|
32
27
|
xhr.onreadystatechange = function () {
|
|
33
28
|
if (xhr.readyState !== 4) return;
|
|
34
29
|
if (xhr.status === 0 && !xhr.response) return;
|
|
35
|
-
|
|
36
30
|
if (xhr.status === 200 || xhr.status === 0) {
|
|
37
31
|
resolve(xhr.response);
|
|
38
32
|
clear();
|
|
@@ -41,7 +35,6 @@ var Preloader = {
|
|
|
41
35
|
clear();
|
|
42
36
|
}
|
|
43
37
|
};
|
|
44
|
-
|
|
45
38
|
xhr.open('GET', url, true);
|
|
46
39
|
xhr.responseType = 'blob';
|
|
47
40
|
xhr.send(null);
|
|
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addResizeListener = addResizeListener;
|
|
7
7
|
exports.hasResizeListener = hasResizeListener;
|
|
8
8
|
var resizeObserverCache = new Map();
|
|
9
|
-
|
|
10
9
|
function addResizeListener(element, resizeHandler) {
|
|
11
10
|
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
12
11
|
if (!element) return function () {};
|
|
13
12
|
if (immediate) resizeHandler(element.clientWidth, element.clientHeight);
|
|
14
|
-
|
|
15
13
|
if (typeof ResizeObserver !== 'undefined' && ResizeObserver) {
|
|
16
14
|
var resizeObserver = new ResizeObserver(function () {
|
|
17
15
|
return resizeHandler(element.clientWidth, element.clientHeight);
|
|
@@ -20,7 +18,6 @@ function addResizeListener(element, resizeHandler) {
|
|
|
20
18
|
resizeObserverCache.set(element, resizeObserverCache.get(element) || 0 + 1);
|
|
21
19
|
return function () {
|
|
22
20
|
if (element) resizeObserver.unobserve(element);
|
|
23
|
-
|
|
24
21
|
if (resizeObserverCache.get(element) === 1) {
|
|
25
22
|
resizeObserverCache["delete"](element);
|
|
26
23
|
}
|
|
@@ -37,14 +34,12 @@ function addResizeListener(element, resizeHandler) {
|
|
|
37
34
|
resizeObserverCache.set(element, resizeObserverCache.get(element) || 0 + 1);
|
|
38
35
|
return function () {
|
|
39
36
|
element.removeChild(iframe);
|
|
40
|
-
|
|
41
37
|
if (resizeObserverCache.get(element) === 1) {
|
|
42
38
|
resizeObserverCache["delete"](element);
|
|
43
39
|
}
|
|
44
40
|
};
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
function hasResizeListener(element) {
|
|
49
44
|
if (!element) return false;
|
|
50
45
|
return resizeObserverCache.get(element) || 0 > 0;
|
|
@@ -1,98 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.BetterTween = void 0;
|
|
9
8
|
exports.tweenProgress = tweenProgress;
|
|
10
|
-
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
16
|
var _tween = _interopRequireDefault(require("@tweenjs/tween.js"));
|
|
12
|
-
|
|
13
17
|
var _ = require(".");
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
|
|
17
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
18
|
-
|
|
19
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
-
|
|
21
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
|
-
|
|
23
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
24
|
-
|
|
25
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
26
|
-
|
|
27
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
28
|
-
|
|
29
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
30
|
-
|
|
31
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
32
|
-
|
|
18
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
33
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
34
|
-
|
|
35
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
36
|
-
|
|
37
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
38
|
-
|
|
39
20
|
var BetterTween = /*#__PURE__*/function (_TWEEN$Tween) {
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
(0, _inherits2["default"])(BetterTween, _TWEEN$Tween);
|
|
42
22
|
var _super = _createSuper(BetterTween);
|
|
43
|
-
|
|
44
23
|
function BetterTween() {
|
|
45
24
|
var _this;
|
|
46
|
-
|
|
47
|
-
_classCallCheck(this, BetterTween);
|
|
48
|
-
|
|
25
|
+
(0, _classCallCheck2["default"])(this, BetterTween);
|
|
49
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
27
|
args[_key] = arguments[_key];
|
|
51
28
|
}
|
|
52
|
-
|
|
53
29
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
_defineProperty(_assertThisInitialized(_this), "onDispose", function (callback) {
|
|
30
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "disposeMethods", []);
|
|
31
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDispose", function (callback) {
|
|
58
32
|
_this.disposeMethods.push(callback);
|
|
59
|
-
|
|
60
|
-
return _assertThisInitialized(_this);
|
|
33
|
+
return (0, _assertThisInitialized2["default"])(_this);
|
|
61
34
|
});
|
|
62
|
-
|
|
63
|
-
_defineProperty(_assertThisInitialized(_this), "play", function () {
|
|
35
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "play", function () {
|
|
64
36
|
_this.start();
|
|
65
|
-
|
|
66
37
|
_this.animationFrameDisposer = (0, _.requestAnimationFrameInterval)(function () {
|
|
67
38
|
return _this.update();
|
|
68
39
|
});
|
|
69
|
-
return
|
|
40
|
+
return (0, _assertThisInitialized2["default"])(_this);
|
|
70
41
|
});
|
|
71
|
-
|
|
72
|
-
_defineProperty(_assertThisInitialized(_this), "dispose", function () {
|
|
42
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "dispose", function () {
|
|
73
43
|
var _this$animationFrameD, _this2;
|
|
74
|
-
|
|
75
44
|
_this.stop();
|
|
76
|
-
|
|
77
45
|
(_this$animationFrameD = (_this2 = _this).animationFrameDisposer) === null || _this$animationFrameD === void 0 ? void 0 : _this$animationFrameD.call(_this2);
|
|
78
|
-
|
|
79
46
|
_this.disposeMethods.forEach(function (fn) {
|
|
80
47
|
return fn();
|
|
81
48
|
});
|
|
82
|
-
|
|
83
49
|
_this.disposeMethods = [];
|
|
84
|
-
|
|
85
|
-
_tween["default"].remove(_assertThisInitialized(_this));
|
|
50
|
+
_tween["default"].remove((0, _assertThisInitialized2["default"])(_this));
|
|
86
51
|
});
|
|
87
|
-
|
|
88
52
|
return _this;
|
|
89
53
|
}
|
|
90
|
-
|
|
91
|
-
return _createClass(BetterTween);
|
|
54
|
+
return (0, _createClass2["default"])(BetterTween);
|
|
92
55
|
}(_tween["default"].Tween);
|
|
93
|
-
|
|
94
56
|
exports.BetterTween = BetterTween;
|
|
95
|
-
|
|
96
57
|
function tweenProgress(duration) {
|
|
97
58
|
var easing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _tween["default"].Easing.Linear.None;
|
|
98
59
|
var tween = new BetterTween({
|
|
@@ -7,39 +7,33 @@ exports["default"] = void 0;
|
|
|
7
7
|
exports.getFrameTime = getFrameTime;
|
|
8
8
|
exports.nextFrame = nextFrame;
|
|
9
9
|
exports.requestAnimationFrameInterval = requestAnimationFrameInterval;
|
|
10
|
-
|
|
11
10
|
var _requestAnimationFrame = window.requestAnimationFrame || function (fn) {
|
|
12
11
|
return setTimeout(function () {
|
|
13
12
|
return fn(performance.now());
|
|
14
13
|
}, 16);
|
|
15
14
|
};
|
|
16
|
-
|
|
17
15
|
var _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
|
18
|
-
|
|
19
16
|
var _default = _requestAnimationFrame;
|
|
20
17
|
exports["default"] = _default;
|
|
21
|
-
|
|
22
18
|
function nextFrame(fn) {
|
|
23
19
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
24
20
|
if (delay <= 0) _requestAnimationFrame(fn);else _requestAnimationFrame(function () {
|
|
25
21
|
return nextFrame(fn, delay - 1);
|
|
26
22
|
});
|
|
27
23
|
}
|
|
24
|
+
|
|
28
25
|
/**
|
|
29
26
|
* 在每个 AnimationFrame 中调用传入的函数
|
|
30
27
|
* @param callback 每次 AnimationFrame 中调用的函数
|
|
31
28
|
* @param frame 每秒运行多少次
|
|
32
29
|
* @returns 返回一个函数,调用可以停止 AnimationFrameLoop
|
|
33
30
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
31
|
function requestAnimationFrameInterval(callback) {
|
|
37
32
|
var frame = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
|
|
38
33
|
var index = -1;
|
|
39
34
|
var oldTime = 0;
|
|
40
35
|
var startTime = -1;
|
|
41
36
|
var minDeltaTime = 1000 / frame;
|
|
42
|
-
|
|
43
37
|
function loop(time) {
|
|
44
38
|
startTime === -1 && (startTime = time);
|
|
45
39
|
index = _requestAnimationFrame(loop);
|
|
@@ -48,18 +42,16 @@ function requestAnimationFrameInterval(callback) {
|
|
|
48
42
|
oldTime = time;
|
|
49
43
|
callback && callback(time - startTime);
|
|
50
44
|
}
|
|
51
|
-
|
|
52
45
|
index = _requestAnimationFrame(loop);
|
|
53
46
|
return function stop() {
|
|
54
47
|
_cancelAnimationFrame(index);
|
|
55
48
|
};
|
|
56
49
|
}
|
|
50
|
+
|
|
57
51
|
/**
|
|
58
52
|
* 获取两个 AnimationFrame 间隔的时间
|
|
59
53
|
* @returns 返回一个 Promise,resolve 的结果是两个 AnimationFrame 间隔的时间
|
|
60
54
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
55
|
function getFrameTime() {
|
|
64
56
|
var start = Date.now();
|
|
65
57
|
return new Promise(function (resolve) {
|
|
@@ -5,11 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = tween;
|
|
7
7
|
exports.tweenProgress = tweenProgress;
|
|
8
|
-
|
|
9
8
|
var _tween = require("@tweenjs/tween.js");
|
|
10
|
-
|
|
11
9
|
var _index = require("./index");
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* 对象变化的补间动画
|
|
15
12
|
* 1. 应用 requestAnimationFrameInterval 做 update
|
|
@@ -22,8 +19,8 @@ var _index = require("./index");
|
|
|
22
19
|
*/
|
|
23
20
|
function tween(from, to, duration) {
|
|
24
21
|
var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _tween.Easing.Linear.None;
|
|
25
|
-
var tween = new _tween.Tween(from).to(to, duration).easing(easing);
|
|
26
|
-
|
|
22
|
+
var tween = new _tween.Tween(from).to(to, duration).easing(easing);
|
|
23
|
+
// 这里注意一下,因为 requestAnimationFrameInterval 给的时间是从 0 开始的,tween 动画也从 0 开始
|
|
27
24
|
(0, _index.nextFrame)(function () {
|
|
28
25
|
return tween.start(0);
|
|
29
26
|
});
|
|
@@ -31,12 +28,10 @@ function tween(from, to, duration) {
|
|
|
31
28
|
if (tween.update(time) === false) cancelAnimationFrame();
|
|
32
29
|
});
|
|
33
30
|
var destroyMethods = [];
|
|
34
|
-
|
|
35
31
|
tween.onDestroy = function (fn) {
|
|
36
32
|
destroyMethods.push(fn);
|
|
37
33
|
return tween;
|
|
38
34
|
};
|
|
39
|
-
|
|
40
35
|
tween.destroy = function () {
|
|
41
36
|
this.stop();
|
|
42
37
|
Object.assign(tween, {
|
|
@@ -46,17 +41,13 @@ function tween(from, to, duration) {
|
|
|
46
41
|
_onStopCallbackL: null
|
|
47
42
|
});
|
|
48
43
|
var destroyMethod;
|
|
49
|
-
|
|
50
44
|
while (destroyMethod = destroyMethods.shift()) {
|
|
51
45
|
destroyMethod();
|
|
52
46
|
}
|
|
53
|
-
|
|
54
47
|
cancelAnimationFrame();
|
|
55
48
|
};
|
|
56
|
-
|
|
57
49
|
return tween;
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
function tweenProgress(duration, easing) {
|
|
61
52
|
return tween({
|
|
62
53
|
progress: 0
|
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createTransMatrix = createTransMatrix;
|
|
9
|
-
|
|
9
|
+
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
-
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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
|
-
|
|
16
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
17
|
-
|
|
18
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
-
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
-
|
|
22
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
-
|
|
24
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
|
|
26
|
-
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); }
|
|
27
|
-
|
|
28
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
-
|
|
30
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
14
|
function createTransMatrix(arr1) {
|
|
35
15
|
var matrix4 = new THREE.Matrix4();
|
|
36
16
|
matrix4.fromArray(arr1);
|
|
37
17
|
return function (arr2) {
|
|
38
|
-
var vector3 =
|
|
39
|
-
|
|
18
|
+
var vector3 = (0, _construct2["default"])(THREE.Vector3, (0, _toConsumableArray2["default"])(arr2));
|
|
40
19
|
vector3.applyMatrix4(matrix4);
|
|
41
20
|
return vector3.toArray();
|
|
42
21
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -8,22 +9,16 @@ exports.getFileName = getFileName;
|
|
|
8
9
|
exports.getMediaType = getMediaType;
|
|
9
10
|
exports.getMediaTypeByExpandedName = getMediaTypeByExpandedName;
|
|
10
11
|
exports.getMediaTypeByUrl = getMediaTypeByUrl;
|
|
11
|
-
|
|
12
12
|
var _getFileExpandedName = _interopRequireDefault(require("./getFileExpandedName"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
13
|
function getMediaInfo(fileUrl) {
|
|
17
14
|
var type = getMediaType(fileUrl);
|
|
18
15
|
if (!type) return Promise.resolve({
|
|
19
16
|
error: '未知的文件类型: ' + fileUrl
|
|
20
17
|
});
|
|
21
|
-
|
|
22
18
|
var mediaElement = function () {
|
|
23
19
|
if (type === 'video') return document.createElement('video');
|
|
24
20
|
if (type === 'audio') return document.createElement('audio');
|
|
25
21
|
}();
|
|
26
|
-
|
|
27
22
|
if (!mediaElement) return Promise.resolve({
|
|
28
23
|
error: 'Unknown media element'
|
|
29
24
|
});
|
|
@@ -34,7 +29,6 @@ function getMediaInfo(fileUrl) {
|
|
|
34
29
|
error: 'onerror'
|
|
35
30
|
});
|
|
36
31
|
};
|
|
37
|
-
|
|
38
32
|
mediaElement.onloadedmetadata = function () {
|
|
39
33
|
resolve({
|
|
40
34
|
duration: mediaElement.duration * 1000,
|
|
@@ -49,7 +43,6 @@ function getMediaType(url) {
|
|
|
49
43
|
var type = getMediaTypeByExpandedName(fileExpandedName);
|
|
50
44
|
return type;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
function getMediaTypeByExpandedName(fileExpandedName) {
|
|
54
47
|
if (!fileExpandedName) return 'unknown';
|
|
55
48
|
if (/jpg|jpeg|png$/.test(fileExpandedName)) return 'image';
|
|
@@ -57,13 +50,11 @@ function getMediaTypeByExpandedName(fileExpandedName) {
|
|
|
57
50
|
if (/avi|wmv|mpeg|mp4|m4v|mov|asf|flv|f4v|rmvb|rm|3gp|vob$/.test(fileExpandedName)) return 'video';
|
|
58
51
|
return 'unknown';
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
function getMediaTypeByUrl(fileUrl) {
|
|
62
54
|
if (!fileUrl) return;
|
|
63
55
|
var fileExpandedName = (0, _getFileExpandedName["default"])(fileUrl);
|
|
64
56
|
return getMediaTypeByExpandedName(fileExpandedName);
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
function getFileName(fileUrl) {
|
|
68
59
|
if (!fileUrl) return '';
|
|
69
60
|
var index1 = fileUrl.lastIndexOf('/');
|
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = setElementDataset;
|
|
7
|
-
|
|
8
7
|
function setElementDataset(element, dataset) {
|
|
9
8
|
if (element) {
|
|
10
9
|
Object.keys(dataset).forEach(function (key) {
|
|
11
10
|
var value = dataset[key].toString();
|
|
12
|
-
|
|
13
11
|
if (element instanceof Element) {
|
|
14
12
|
element.setAttribute("data-".concat(key), value);
|
|
15
13
|
} else if (element instanceof Document) {
|
package/lib/typings/VreoUnit.js
CHANGED
|
@@ -8,9 +8,7 @@ var VreoKeyframeEnum;
|
|
|
8
8
|
/**
|
|
9
9
|
* 支持自定义剧本关键帧配置项
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
11
|
exports.VreoKeyframeEnum = VreoKeyframeEnum;
|
|
13
|
-
|
|
14
12
|
(function (VreoKeyframeEnum) {
|
|
15
13
|
VreoKeyframeEnum["CameraMovement"] = "CameraMovement";
|
|
16
14
|
VreoKeyframeEnum["PanoTag"] = "PanoTag";
|
|
@@ -25,7 +23,6 @@ exports.VreoKeyframeEnum = VreoKeyframeEnum;
|
|
|
25
23
|
VreoKeyframeEnum["Exit"] = "Exit";
|
|
26
24
|
VreoKeyframeEnum["Custom"] = "Custom";
|
|
27
25
|
})(VreoKeyframeEnum || (exports.VreoKeyframeEnum = VreoKeyframeEnum = {}));
|
|
28
|
-
|
|
29
26
|
/**
|
|
30
27
|
* 全景标签枚举
|
|
31
28
|
*/
|
|
@@ -33,22 +30,17 @@ var PanoTagEnum;
|
|
|
33
30
|
/**
|
|
34
31
|
* 标签样式种类
|
|
35
32
|
*/
|
|
36
|
-
|
|
37
33
|
exports.PanoTagEnum = PanoTagEnum;
|
|
38
|
-
|
|
39
34
|
(function (PanoTagEnum) {
|
|
40
35
|
PanoTagEnum["Text"] = "Text";
|
|
41
36
|
PanoTagEnum["Image"] = "Image";
|
|
42
37
|
})(PanoTagEnum || (exports.PanoTagEnum = PanoTagEnum = {}));
|
|
43
|
-
|
|
44
38
|
var PanoTagStyleEnum;
|
|
45
39
|
exports.PanoTagStyleEnum = PanoTagStyleEnum;
|
|
46
|
-
|
|
47
40
|
(function (PanoTagStyleEnum) {
|
|
48
41
|
PanoTagStyleEnum["Growth"] = "Growth";
|
|
49
42
|
PanoTagStyleEnum["Expand"] = "Expand";
|
|
50
43
|
})(PanoTagStyleEnum || (exports.PanoTagStyleEnum = PanoTagStyleEnum = {}));
|
|
51
|
-
|
|
52
44
|
/**
|
|
53
45
|
* 全景特效枚举
|
|
54
46
|
*/
|
|
@@ -56,31 +48,24 @@ var PanoEffectEnum;
|
|
|
56
48
|
/**
|
|
57
49
|
* 全景特效
|
|
58
50
|
*/
|
|
59
|
-
|
|
60
51
|
exports.PanoEffectEnum = PanoEffectEnum;
|
|
61
|
-
|
|
62
52
|
(function (PanoEffectEnum) {
|
|
63
53
|
PanoEffectEnum["Distance"] = "Distance";
|
|
64
54
|
})(PanoEffectEnum || (exports.PanoEffectEnum = PanoEffectEnum = {}));
|
|
65
|
-
|
|
66
55
|
/**
|
|
67
56
|
* 信息面板类型枚举
|
|
68
57
|
*/
|
|
69
58
|
var InfoPanelTypeEnum;
|
|
70
59
|
exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
|
|
71
|
-
|
|
72
60
|
(function (InfoPanelTypeEnum) {
|
|
73
61
|
InfoPanelTypeEnum["Image"] = "Image";
|
|
74
62
|
InfoPanelTypeEnum["Video"] = "Video";
|
|
75
63
|
})(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
|
|
76
|
-
|
|
77
64
|
var InfoPanelStyleEnum;
|
|
78
65
|
/**
|
|
79
66
|
* 信息面板
|
|
80
67
|
*/
|
|
81
|
-
|
|
82
68
|
exports.InfoPanelStyleEnum = InfoPanelStyleEnum;
|
|
83
|
-
|
|
84
69
|
(function (InfoPanelStyleEnum) {
|
|
85
70
|
InfoPanelStyleEnum["Drawer"] = "Drawer";
|
|
86
71
|
InfoPanelStyleEnum["PopUp"] = "PopUp";
|