@realsee/dnalogel 0.1.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.
- package/README.md +94 -0
- package/TERMS.txt +56 -0
- package/components/ARVideoFigure/ARVideoFigureMesh.d.ts +44 -0
- package/components/ARVideoFigure/ARVideoFigureMesh.js +347 -0
- package/components/ARVideoFigure/ARVideoFigureScene.d.ts +11 -0
- package/components/ARVideoFigure/ARVideoFigureScene.js +74 -0
- package/components/ARVideoFigure/ImgBgTransparent.d.ts +16 -0
- package/components/ARVideoFigure/ImgBgTransparent.js +49 -0
- package/components/ARVideoFigure/ImgBgTransparentMesh.d.ts +30 -0
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +173 -0
- package/components/ARVideoFigure/fragmentShader.d.ts +5 -0
- package/components/ARVideoFigure/fragmentShader.js +16 -0
- package/components/ARVideoFigure/index.d.ts +15 -0
- package/components/ARVideoFigure/index.js +64 -0
- package/components/ARVideoFigure/vertexShader.d.ts +1 -0
- package/components/ARVideoFigure/vertexShader.js +8 -0
- package/components/GlassFilters/index.d.ts +32 -0
- package/components/GlassFilters/index.js +54 -0
- package/components/ModelView/ModelViewController.d.ts +18 -0
- package/components/ModelView/ModelViewController.js +147 -0
- package/components/ModelView/index.d.ts +10 -0
- package/components/ModelView/index.js +22 -0
- package/components/PBRView/index.d.ts +14 -0
- package/components/PBRView/index.js +31 -0
- package/components/PaintBrush/index.d.ts +16 -0
- package/components/PaintBrush/index.js +33 -0
- package/components/PanoTag/index.d.ts +4 -0
- package/components/PanoTag/index.js +11 -0
- package/custom.d.js +3 -0
- package/data/1aGKl9JmrlXMXx8d.d.ts +104 -0
- package/data/1aGKl9JmrlXMXx8d.js +535 -0
- package/data/6gyq3v1verxD7JO1.d.ts +104 -0
- package/data/6gyq3v1verxD7JO1.js +460 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.d.ts +84 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +598 -0
- package/data/PrXel3aqGbp34JQn.d.ts +389 -0
- package/data/PrXel3aqGbp34JQn.js +4639 -0
- package/data/YdoNP9K4rwQDwjJr.d.ts +83 -0
- package/data/YdoNP9K4rwQDwjJr.js +1451 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.d.ts +86 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +709 -0
- package/data/oPzy3ApbjjpD8YdR.d.ts +83 -0
- package/data/oPzy3ApbjjpD8YdR.js +281 -0
- package/data/qjAxMG4XbPn96wKG.d.ts +104 -0
- package/data/qjAxMG4XbPn96wKG.js +635 -0
- package/data/rXel3aPQRRBD4JQn.d.ts +86 -0
- package/data/rXel3aPQRRBD4JQn.js +620 -0
- package/data/vLykj3NWrllMrG06.d.ts +89 -0
- package/data/vLykj3NWrllMrG06.js +2532 -0
- package/data/wYnRjQ4KZoV1yPoG.d.ts +114 -0
- package/data/wYnRjQ4KZoV1yPoG.js +512 -0
- package/data/wz0QV9KA4ugyo9ME.d.ts +39 -0
- package/data/wz0QV9KA4ugyo9ME.js +134 -0
- package/examples/FiveStateController/index.js +140 -0
- package/examples/VRHouse/Mobile.js +22 -0
- package/examples/VRHouse/PC.js +22 -0
- package/examples/VRHouse/index.js +22 -0
- package/index.d.ts +15 -0
- package/index.js +43 -0
- package/package.json +19 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.d.ts +12 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +113 -0
- package/plugins/CSS3DRenderPlugin/index.d.ts +49 -0
- package/plugins/CSS3DRenderPlugin/index.js +220 -0
- package/plugins/CameraMovementPlugin/index.d.ts +7 -0
- package/plugins/CameraMovementPlugin/index.js +338 -0
- package/plugins/CameraMovementPlugin/typing.d.ts +68 -0
- package/plugins/CameraMovementPlugin/typing.js +35 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +15 -0
- package/plugins/ModelChassisCompassPlugin/index.js +156 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +10 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.js +16 -0
- package/plugins/ModelTVVideoPlugin/index.d.ts +21 -0
- package/plugins/ModelTVVideoPlugin/index.js +313 -0
- package/plugins/ModelViewPlugin/index.d.ts +17 -0
- package/plugins/ModelViewPlugin/index.js +199 -0
- package/plugins/PanoCursorRaycasterPlugin/PanoCursorRaycasterPluginUsage.d.ts +48 -0
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.d.ts +9 -0
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +113 -0
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.d.ts +11 -0
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +25 -0
- package/plugins/PanoCursorRaycasterPlugin/index.d.ts +49 -0
- package/plugins/PanoCursorRaycasterPlugin/index.js +119 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.d.ts +5 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +25 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.d.ts +3 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +34 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.d.ts +7 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.js +18 -0
- package/plugins/PanoDoorLabelPlugin/index.d.ts +4 -0
- package/plugins/PanoDoorLabelPlugin/index.js +12 -0
- package/plugins/PanoIRobotPlugin/index.d.ts +10 -0
- package/plugins/PanoIRobotPlugin/index.js +16 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.d.ts +3 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.js +49 -0
- package/plugins/PanoRulerPlugin/data/roomRules.d.ts +3 -0
- package/plugins/PanoRulerPlugin/data/roomRules.js +233 -0
- package/plugins/PanoRulerPlugin/index.d.ts +27 -0
- package/plugins/PanoRulerPlugin/index.js +589 -0
- package/plugins/PanoRulerPlugin/typings.d.ts +21 -0
- package/plugins/PanoRulerPlugin/typings.js +5 -0
- package/plugins/PanoTVVideoPlugin/index.d.ts +24 -0
- package/plugins/PanoTVVideoPlugin/index.js +351 -0
- package/plugins/TreasurePlugin/Controller.d.ts +32 -0
- package/plugins/TreasurePlugin/Controller.js +175 -0
- package/plugins/TreasurePlugin/TreasureFaceAnime.d.ts +23 -0
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +128 -0
- package/plugins/TreasurePlugin/TreasureObject.d.ts +35 -0
- package/plugins/TreasurePlugin/TreasureObject.js +186 -0
- package/plugins/TreasurePlugin/TreasureOpenAnime.d.ts +23 -0
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +103 -0
- package/plugins/TreasurePlugin/constants.d.ts +12 -0
- package/plugins/TreasurePlugin/constants.js +30 -0
- package/plugins/TreasurePlugin/index.d.ts +11 -0
- package/plugins/TreasurePlugin/index.js +16 -0
- package/plugins/TreasurePlugin/treasureDataMap.d.ts +7 -0
- package/plugins/TreasurePlugin/treasureDataMap.js +20 -0
- package/plugins/TreasurePlugin/typings.d.ts +2 -0
- package/plugins/TreasurePlugin/typings.js +5 -0
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.d.ts +7 -0
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.js +115 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.js +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +100 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +643 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +58 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.d.ts +5 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +69 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.d.ts +10 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +105 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +95 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +48 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +20 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +66 -0
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.d.ts +1 -0
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +14 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.d.ts +9 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.js +18 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +23 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +5 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +15 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +31 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.d.ts +14 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +162 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.d.ts +13 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +91 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.d.ts +3 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +35 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.d.ts +5 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +50 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.d.ts +9 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +102 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.d.ts +11 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +42 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.d.ts +17 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +75 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.d.ts +2 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +13 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +33 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +214 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.d.ts +8 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +18 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +55 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +267 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/index.js +16 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.d.ts +1 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.js +14 -0
- package/plugins/floorplan/components/FloorplanImage.d.ts +7 -0
- package/plugins/floorplan/components/FloorplanImage.js +76 -0
- package/plugins/floorplan/typings/floorplanData.d.ts +127 -0
- package/plugins/floorplan/typings/floorplanData.js +5 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +125 -0
- package/plugins/floorplan/typings/floorplanServerData.js +380 -0
- package/plugins/floorplan/utils/formatData.d.ts +5 -0
- package/plugins/floorplan/utils/formatData.js +220 -0
- package/plugins/floorplan/utils/formatPosition.d.ts +37 -0
- package/plugins/floorplan/utils/formatPosition.js +87 -0
- package/shared-utils/Preloader.d.ts +6 -0
- package/shared-utils/Preloader.js +51 -0
- package/shared-utils/Subscribe.d.ts +45 -0
- package/shared-utils/Subscribe.js +210 -0
- package/shared-utils/animationFrame/BetterTween.d.ts +11 -0
- package/shared-utils/animationFrame/BetterTween.js +102 -0
- package/shared-utils/animationFrame/calculateProgress.d.ts +8 -0
- package/shared-utils/animationFrame/calculateProgress.js +38 -0
- package/shared-utils/animationFrame/formatRad.d.ts +15 -0
- package/shared-utils/animationFrame/formatRad.js +34 -0
- package/shared-utils/animationFrame/index.d.ts +15 -0
- package/shared-utils/animationFrame/index.js +69 -0
- package/shared-utils/animationFrame/tween.d.ts +75 -0
- package/shared-utils/animationFrame/tween.js +76 -0
- package/shared-utils/changeModelCanvansOpacity.d.ts +2 -0
- package/shared-utils/changeModelCanvansOpacity.js +24 -0
- package/shared-utils/createFiveContainer.d.ts +10 -0
- package/shared-utils/createFiveContainer.js +165 -0
- package/shared-utils/createLine/index.d.ts +3 -0
- package/shared-utils/createLine/index.js +29 -0
- package/shared-utils/debounce.d.ts +6 -0
- package/shared-utils/debounce.js +26 -0
- package/shared-utils/equal.d.ts +11 -0
- package/shared-utils/equal.js +96 -0
- package/shared-utils/filter.d.ts +27 -0
- package/shared-utils/filter.js +93 -0
- package/shared-utils/five/changeMode.d.ts +2 -0
- package/shared-utils/five/changeMode.js +86 -0
- package/shared-utils/five/useFivePlugin.d.ts +1 -0
- package/shared-utils/five/useFivePlugin.js +15 -0
- package/shared-utils/formatRad.d.ts +7 -0
- package/shared-utils/formatRad.js +16 -0
- package/shared-utils/getPxmm.d.ts +6 -0
- package/shared-utils/getPxmm.js +37 -0
- package/shared-utils/getRandomColor.d.ts +1 -0
- package/shared-utils/getRandomColor.js +13 -0
- package/shared-utils/isTruelyObject.d.ts +18 -0
- package/shared-utils/isTruelyObject.js +27 -0
- package/shared-utils/math/evenNumber.d.ts +1 -0
- package/shared-utils/math/evenNumber.js +11 -0
- package/shared-utils/math/planimetry.d.ts +116 -0
- package/shared-utils/math/planimetry.js +342 -0
- package/shared-utils/math/rad2Deg.d.ts +1 -0
- package/shared-utils/math/rad2Deg.js +10 -0
- package/shared-utils/nearlyEqual.d.ts +7 -0
- package/shared-utils/nearlyEqual.js +17 -0
- package/shared-utils/nextFrame.d.ts +1 -0
- package/shared-utils/nextFrame.js +13 -0
- package/shared-utils/noop.d.ts +5 -0
- package/shared-utils/noop.js +17 -0
- package/shared-utils/object3d2LocalMatrix.d.ts +12 -0
- package/shared-utils/object3d2LocalMatrix.js +73 -0
- package/shared-utils/px2rem.d.ts +1 -0
- package/shared-utils/px2rem.js +12 -0
- package/shared-utils/tap.d.ts +8 -0
- package/shared-utils/tap.js +19 -0
- package/shared-utils/three/centerPoint.d.ts +2 -0
- package/shared-utils/three/centerPoint.js +12 -0
- package/shared-utils/three/getNormal.d.ts +2 -0
- package/shared-utils/three/getNormal.js +13 -0
- package/shared-utils/three/loadFbxObj.d.ts +3 -0
- package/shared-utils/three/loadFbxObj.js +42 -0
- package/shared-utils/three/loadTexture.d.ts +2 -0
- package/shared-utils/three/loadTexture.js +38 -0
- package/shared-utils/three/vecror3.d.ts +7 -0
- package/shared-utils/three/vecror3.js +18 -0
- package/shared-utils/throttle.d.ts +7 -0
- package/shared-utils/throttle.js +25 -0
- package/shared-utils/to.d.ts +9 -0
- package/shared-utils/to.js +25 -0
- package/shared-utils/useDebounce.d.ts +8 -0
- package/shared-utils/useDebounce.js +43 -0
- package/shared-utils/useThrottle.d.ts +8 -0
- package/shared-utils/useThrottle.js +41 -0
- package/shared-utils/uuid.d.ts +4 -0
- package/shared-utils/uuid.js +20 -0
- package/shared-utils/vectorTocoordinates.d.ts +7 -0
- package/shared-utils/vectorTocoordinates.js +16 -0
- package/typedoc/components.d.ts +6 -0
- package/typedoc/components.js +5 -0
- package/typedoc/plugins.d.ts +17 -0
- package/typedoc/plugins.js +113 -0
- package/typedoc/shared-utils.d.ts +3 -0
- package/typedoc/shared-utils.js +5 -0
- package/typedoc/typings.d.ts +3 -0
- package/typedoc/typings.js +5 -0
- package/typings/math.type.d.ts +44 -0
- package/typings/math.type.js +5 -0
- package/typings/utils.type.d.ts +2 -0
- package/typings/utils.type.js +5 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.CSS3DRenderPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
var _CSS3DRenderer = require("three/examples/jsm/renderers/CSS3DRenderer");
|
|
13
|
+
|
|
14
|
+
var _evenNumber = _interopRequireDefault(require("../../shared-utils/math/evenNumber"));
|
|
15
|
+
|
|
16
|
+
var _centerPoint = _interopRequireDefault(require("../../shared-utils/three/centerPoint"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* **CSS3DRenderPlugin** 提供矩形区域(三维空间四个坐标点),你可以在此矩形区域中渲染 DOM 内容。
|
|
28
|
+
* 实现原理参考[CSS3DRenderer](https://threejs.org/docs/index.html?q=CSS3D#examples/en/renderers/CSS3DRenderer)。
|
|
29
|
+
*
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
var CSS3DRenderPlugin = function CSS3DRenderPlugin(five, _ref) {
|
|
33
|
+
_objectDestructuringEmpty(_ref);
|
|
34
|
+
|
|
35
|
+
var state = {
|
|
36
|
+
disposeCallbacks: []
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var create3DDomContainer = function create3DDomContainer(points, container, config) {
|
|
40
|
+
var _five$model;
|
|
41
|
+
|
|
42
|
+
if ((points === null || points === void 0 ? void 0 : points.length) < 3) {
|
|
43
|
+
return console.error('points must be equal or greater than than 3');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) {
|
|
47
|
+
var _five$model2;
|
|
48
|
+
|
|
49
|
+
return console.error('five.model.loaded is: ', five === null || five === void 0 ? void 0 : (_five$model2 = five.model) === null || _five$model2 === void 0 ? void 0 : _five$model2.loaded);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var fiveElement = five.getElement();
|
|
53
|
+
|
|
54
|
+
if (!fiveElement) {
|
|
55
|
+
return console.error('five.getElement() is ' + fiveElement);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var disposers = [];
|
|
59
|
+
var ratio = (config === null || config === void 0 ? void 0 : config.ratio) || 0.002; // 0.72 / 354 0.72m宽的窗户,UI稿上是354像素
|
|
60
|
+
|
|
61
|
+
var dpr = (config === null || config === void 0 ? void 0 : config.dpr) || 1;
|
|
62
|
+
var mode = (config === null || config === void 0 ? void 0 : config.mode) || 'front';
|
|
63
|
+
var autoRender = (config === null || config === void 0 ? void 0 : config.autoRender) || true;
|
|
64
|
+
var behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
|
|
65
|
+
var planeWidth = points[0].distanceTo(points[1]);
|
|
66
|
+
var planeHeight = points[1].distanceTo(points[2]);
|
|
67
|
+
var domWidthPx = (0, _evenNumber["default"])(planeWidth / ratio * dpr);
|
|
68
|
+
var domHeightPx = (0, _evenNumber["default"])(planeHeight / ratio * dpr);
|
|
69
|
+
var css3DScene = new THREE.Scene();
|
|
70
|
+
var element = container || document.createElement('div');
|
|
71
|
+
var object = new _CSS3DRenderer.CSS3DObject(element);
|
|
72
|
+
object.scale.set(ratio, ratio, ratio);
|
|
73
|
+
element.style.width = domWidthPx + 'px';
|
|
74
|
+
element.style.height = domHeightPx + 'px';
|
|
75
|
+
element.style.pointerEvents = 'none';
|
|
76
|
+
var centerPosition = (0, _centerPoint["default"])(points[0], points[2]);
|
|
77
|
+
var vector01 = points[1].clone().sub(points[0]); // 点0 -> 点1 的向量
|
|
78
|
+
|
|
79
|
+
var vector12 = points[2].clone().sub(points[1]); // 点1 -> 点2 的向量
|
|
80
|
+
// 旋转
|
|
81
|
+
|
|
82
|
+
var rotateXAngle = new THREE.Vector3(0, 1, 0).angleTo(new THREE.Vector3(0, vector12.y, vector12.z));
|
|
83
|
+
var rotateYAngle = new THREE.Vector3(1, 0, 0).angleTo(new THREE.Vector3(vector01.x, 0, vector01.z));
|
|
84
|
+
var rotateZAngle = vector01.angleTo(new THREE.Vector3(vector01.x, 0, vector01.z));
|
|
85
|
+
/**
|
|
86
|
+
* [0,1,0] => [0,0,1] 为rolate Worldx正方向
|
|
87
|
+
* [0,0,1] => [0,1,0] 为rolate Worldy正方向
|
|
88
|
+
* [0,1,1] => [-1,0,0] 为rolate Worldz正方向
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
var rolateX = (vector12.z > 0 ? 1 : -1) * rotateXAngle;
|
|
92
|
+
var rolateY = (vector01.z < 0 ? 1 : -1) * rotateYAngle;
|
|
93
|
+
var rolateZ = (vector01.x > 0 && vector01.y < 0 || vector01.x < 0 && vector01.y > 0 ? -1 : 1) * rotateZAngle;
|
|
94
|
+
object.rotateOnWorldAxis(new THREE.Vector3(1, 0, 0), rolateX); // x
|
|
95
|
+
|
|
96
|
+
object.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), rolateY); // y
|
|
97
|
+
|
|
98
|
+
object.rotateOnWorldAxis(new THREE.Vector3(0, 0, 1), rolateZ); // z
|
|
99
|
+
|
|
100
|
+
object.position.set(centerPosition.x, centerPosition.y, centerPosition.z);
|
|
101
|
+
css3DScene.add(object);
|
|
102
|
+
var mesh;
|
|
103
|
+
|
|
104
|
+
if (mode === 'behind') {
|
|
105
|
+
var material = new THREE.MeshBasicMaterial({
|
|
106
|
+
opacity: 0,
|
|
107
|
+
transparent: false,
|
|
108
|
+
side: THREE.DoubleSide
|
|
109
|
+
});
|
|
110
|
+
var geometry = new THREE.PlaneGeometry(domWidthPx, domHeightPx);
|
|
111
|
+
mesh = new THREE.Mesh(geometry, material);
|
|
112
|
+
mesh.name = 'CSS3DRenderPlugin-mesh';
|
|
113
|
+
mesh.position.copy(object.position);
|
|
114
|
+
mesh.rotation.copy(object.rotation);
|
|
115
|
+
mesh.scale.copy(object.scale);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var css3DRenderer = new _CSS3DRenderer.CSS3DRenderer();
|
|
119
|
+
|
|
120
|
+
var css3DRendererSetSize = function css3DRendererSetSize() {
|
|
121
|
+
var rendererWidth = (0, _evenNumber["default"])(fiveElement.clientWidth);
|
|
122
|
+
var rendererHeight = (0, _evenNumber["default"])(fiveElement.clientHeight);
|
|
123
|
+
css3DRenderer.setSize(rendererWidth, rendererHeight);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
css3DRendererSetSize();
|
|
127
|
+
var resizeObserver = new ResizeObserver(css3DRendererSetSize);
|
|
128
|
+
css3DRenderer.domElement.style.position = 'absolute';
|
|
129
|
+
css3DRenderer.domElement.style.top = '0';
|
|
130
|
+
css3DRenderer.domElement.style.userSelect = 'none';
|
|
131
|
+
css3DRenderer.domElement.style.pointerEvents = 'none';
|
|
132
|
+
|
|
133
|
+
if (mode === 'front') {
|
|
134
|
+
var wrapper = fiveElement.parentElement || document.body;
|
|
135
|
+
wrapper.appendChild(css3DRenderer.domElement);
|
|
136
|
+
} else {
|
|
137
|
+
var _wrapper = behindFiveContainer;
|
|
138
|
+
|
|
139
|
+
_wrapper.appendChild(css3DRenderer.domElement);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var stopRenderFlag = false;
|
|
143
|
+
var requestAnimationFrameId = null;
|
|
144
|
+
|
|
145
|
+
var dispose = function dispose() {
|
|
146
|
+
stopRenderFlag = true;
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
disposers.forEach(function (d) {
|
|
150
|
+
return d === null || d === void 0 ? void 0 : d();
|
|
151
|
+
});
|
|
152
|
+
element.remove();
|
|
153
|
+
|
|
154
|
+
if (typeof requestAnimationFrameId === 'number') {
|
|
155
|
+
cancelAnimationFrame(requestAnimationFrameId);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
css3DScene.remove(object);
|
|
159
|
+
css3DScene.dispose();
|
|
160
|
+
css3DRenderer.domElement.remove();
|
|
161
|
+
resizeObserver.unobserve(fiveElement);
|
|
162
|
+
return true;
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.warn('error:', e);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return false;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
var idx = state.disposeCallbacks.findIndex(function (item) {
|
|
171
|
+
return item === dispose;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
if (idx !== -1) {
|
|
175
|
+
state.disposeCallbacks.splice(idx, 1);
|
|
176
|
+
} else {
|
|
177
|
+
state.disposeCallbacks.push(dispose);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
var renderEveryFrame = function renderEveryFrame() {
|
|
181
|
+
if (stopRenderFlag) return;
|
|
182
|
+
requestAnimationFrameId = requestAnimationFrame(renderEveryFrame);
|
|
183
|
+
css3DRenderer.render(css3DScene, five.camera);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var render = function render() {
|
|
187
|
+
resizeObserver.observe(fiveElement);
|
|
188
|
+
renderEveryFrame();
|
|
189
|
+
|
|
190
|
+
if (mode === 'behind' && mesh) {
|
|
191
|
+
five.scene.add(mesh);
|
|
192
|
+
disposers.push(function () {
|
|
193
|
+
return mesh && five.scene.remove(mesh);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
if (autoRender) render();
|
|
199
|
+
return {
|
|
200
|
+
container: element,
|
|
201
|
+
dispose: dispose,
|
|
202
|
+
object: object,
|
|
203
|
+
render: autoRender ? undefined : render
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
create3DDomContainer: create3DDomContainer,
|
|
209
|
+
disposeAll: function disposeAll() {
|
|
210
|
+
state.disposeCallbacks.forEach(function (dispose) {
|
|
211
|
+
return dispose === null || dispose === void 0 ? void 0 : dispose();
|
|
212
|
+
});
|
|
213
|
+
state.disposeCallbacks = [];
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
|
|
219
|
+
var _default = CSS3DRenderPlugin;
|
|
220
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FivePlugin } from '@realsee/five';
|
|
2
|
+
import { CameraMovementPluginExportType, CameraMovementPluginParameterType } from './typing';
|
|
3
|
+
/**
|
|
4
|
+
* **运镜插件** 模拟类似于电影运镜效果。
|
|
5
|
+
*/
|
|
6
|
+
export declare const CameraMovementPlugin: FivePlugin<CameraMovementPluginParameterType, CameraMovementPluginExportType>;
|
|
7
|
+
export default CameraMovementPlugin;
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.CameraMovementPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var _five = require("@realsee/five");
|
|
11
|
+
|
|
12
|
+
var TWEEN = _interopRequireWildcard(require("@tweenjs/tween.js"));
|
|
13
|
+
|
|
14
|
+
var _tween2 = require("../../shared-utils/animationFrame/tween");
|
|
15
|
+
|
|
16
|
+
var _typing = require("./typing");
|
|
17
|
+
|
|
18
|
+
var _formatRad = require("../../shared-utils/animationFrame/formatRad");
|
|
19
|
+
|
|
20
|
+
var _calculateProgress = require("../../shared-utils/animationFrame/calculateProgress");
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
27
|
+
|
|
28
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
29
|
+
|
|
30
|
+
var getLongitudeParams = function getLongitudeParams(from, to, rotation) {
|
|
31
|
+
var PI = Math.PI;
|
|
32
|
+
var PI_2 = PI * 2;
|
|
33
|
+
from = (0, _formatRad.formatLongitude)(from);
|
|
34
|
+
to = (0, _formatRad.formatLongitude)(to); // 逆时针旋转,初始值必须是较大的值
|
|
35
|
+
|
|
36
|
+
if (rotation === _typing.Rotation.Anticlockwise && from < to) from += PI_2; // 顺时针旋转,结束值必须是较大值
|
|
37
|
+
|
|
38
|
+
if (rotation === _typing.Rotation.Clockwise && to < from) to += PI_2; // Loop 旋转,找锐角旋转
|
|
39
|
+
// 如果 to 比 from 大 180°,逆时针转
|
|
40
|
+
// 如果 from 比 to 大 180°,顺时针转
|
|
41
|
+
|
|
42
|
+
if (rotation === _typing.Rotation.Loop && to - from > PI) return getLongitudeParams(from, to, _typing.Rotation.Anticlockwise);
|
|
43
|
+
if (rotation === _typing.Rotation.Loop && from - to > PI) return getLongitudeParams(from, to, _typing.Rotation.Clockwise);
|
|
44
|
+
return {
|
|
45
|
+
from: from,
|
|
46
|
+
to: to
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* **运镜插件** 模拟类似于电影运镜效果。
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var CameraMovementPlugin = function CameraMovementPlugin(five) {
|
|
55
|
+
var state = {};
|
|
56
|
+
|
|
57
|
+
var move = /*#__PURE__*/function () {
|
|
58
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args, duration) {
|
|
59
|
+
var opts,
|
|
60
|
+
_args = arguments;
|
|
61
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
opts = _args.length > 2 && _args[2] !== undefined ? _args[2] : {
|
|
66
|
+
preload: true
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (state.interruptCallback) {
|
|
70
|
+
state.interruptCallback(false);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!opts.asyncStartCallback) {
|
|
74
|
+
_context.next = 5;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_context.next = 5;
|
|
79
|
+
return opts.asyncStartCallback();
|
|
80
|
+
|
|
81
|
+
case 5:
|
|
82
|
+
if (!(args.mode && args.mode !== five.currentMode)) {
|
|
83
|
+
_context.next = 8;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_context.next = 8;
|
|
88
|
+
return five.changeMode(args.mode);
|
|
89
|
+
|
|
90
|
+
case 8:
|
|
91
|
+
if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
92
|
+
_context.next = 11;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_context.next = 11;
|
|
97
|
+
return five.preloadPano(args.panoIndex);
|
|
98
|
+
|
|
99
|
+
case 11:
|
|
100
|
+
if (!opts.asyncEndCallback) {
|
|
101
|
+
_context.next = 14;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_context.next = 14;
|
|
106
|
+
return opts.asyncEndCallback();
|
|
107
|
+
|
|
108
|
+
case 14:
|
|
109
|
+
if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
|
|
110
|
+
_context.next = 16;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return _context.abrupt("return", true);
|
|
115
|
+
|
|
116
|
+
case 16:
|
|
117
|
+
_context.next = 18;
|
|
118
|
+
return new Promise(function (resolve, reject) {
|
|
119
|
+
var panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
120
|
+
|
|
121
|
+
if (panoIndex !== undefined) {
|
|
122
|
+
five.moveToPano(panoIndex, Object.assign({
|
|
123
|
+
duration: duration,
|
|
124
|
+
// 移动耗时
|
|
125
|
+
moveEndCallback: function moveEndCallback() {
|
|
126
|
+
return resolve(true);
|
|
127
|
+
},
|
|
128
|
+
// 移动结束
|
|
129
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
130
|
+
return reject(false);
|
|
131
|
+
} // 移动开始
|
|
132
|
+
|
|
133
|
+
}, args));
|
|
134
|
+
} else {
|
|
135
|
+
reject(false);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
case 18:
|
|
140
|
+
return _context.abrupt("return", _context.sent);
|
|
141
|
+
|
|
142
|
+
case 19:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context.stop();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, _callee);
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
return function move(_x, _x2) {
|
|
151
|
+
return _ref.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}();
|
|
154
|
+
|
|
155
|
+
var getAnimeParams = function getAnimeParams(args) {
|
|
156
|
+
var currentFiveState = five.state; // latitude
|
|
157
|
+
|
|
158
|
+
var fromLatitude = (0, _formatRad.formatLatitude)(currentFiveState.latitude);
|
|
159
|
+
var toLatitude = (0, _formatRad.formatLatitude)(args.latitude); // longitude
|
|
160
|
+
|
|
161
|
+
var _getLongitudeParams = getLongitudeParams(currentFiveState.longitude, args.longitude, args.rotation || _typing.Rotation.Loop),
|
|
162
|
+
fromLongitude = _getLongitudeParams.from,
|
|
163
|
+
toLongitude = _getLongitudeParams.to; // fov
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
var fromFov = currentFiveState.fov;
|
|
167
|
+
var toFov = args.fov;
|
|
168
|
+
return {
|
|
169
|
+
from: {
|
|
170
|
+
latitude: fromLatitude,
|
|
171
|
+
longitude: fromLongitude,
|
|
172
|
+
fov: fromFov
|
|
173
|
+
},
|
|
174
|
+
to: {
|
|
175
|
+
latitude: toLatitude,
|
|
176
|
+
longitude: toLongitude,
|
|
177
|
+
fov: toFov
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
var rotate = /*#__PURE__*/function () {
|
|
183
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(args, duration) {
|
|
184
|
+
var opts,
|
|
185
|
+
_getAnimeParams,
|
|
186
|
+
from,
|
|
187
|
+
to,
|
|
188
|
+
_args2 = arguments;
|
|
189
|
+
|
|
190
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
191
|
+
while (1) {
|
|
192
|
+
switch (_context2.prev = _context2.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
195
|
+
|
|
196
|
+
if (state.interruptCallback) {
|
|
197
|
+
state.interruptCallback(false);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!opts.asyncStartCallback) {
|
|
201
|
+
_context2.next = 5;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
_context2.next = 5;
|
|
206
|
+
return opts.asyncStartCallback();
|
|
207
|
+
|
|
208
|
+
case 5:
|
|
209
|
+
if (!(five.currentMode !== _five.Five.Mode.Panorama)) {
|
|
210
|
+
_context2.next = 8;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_context2.next = 8;
|
|
215
|
+
return five.changeMode(_five.Five.Mode.Panorama);
|
|
216
|
+
|
|
217
|
+
case 8:
|
|
218
|
+
if (!(args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
219
|
+
_context2.next = 14;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (!opts.preload) {
|
|
224
|
+
_context2.next = 12;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
_context2.next = 12;
|
|
229
|
+
return five.preloadPano(args.panoIndex);
|
|
230
|
+
|
|
231
|
+
case 12:
|
|
232
|
+
_context2.next = 14;
|
|
233
|
+
return new Promise(function (resolve, reject) {
|
|
234
|
+
if (!args.panoIndex) {
|
|
235
|
+
resolve(true);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
five.moveToPano(args.panoIndex, {
|
|
240
|
+
moveEndCallback: function moveEndCallback() {
|
|
241
|
+
return resolve(true);
|
|
242
|
+
},
|
|
243
|
+
// 移动结束
|
|
244
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
245
|
+
return reject(false);
|
|
246
|
+
} // 移动开始
|
|
247
|
+
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
case 14:
|
|
252
|
+
if (!opts.asyncEndCallback) {
|
|
253
|
+
_context2.next = 17;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
_context2.next = 17;
|
|
258
|
+
return opts.asyncEndCallback();
|
|
259
|
+
|
|
260
|
+
case 17:
|
|
261
|
+
_getAnimeParams = getAnimeParams(args), from = _getAnimeParams.from, to = _getAnimeParams.to;
|
|
262
|
+
_context2.next = 20;
|
|
263
|
+
return new Promise(function (resolve) {
|
|
264
|
+
var onUpdate = function onUpdate(_ref3) {
|
|
265
|
+
var progress = _ref3.progress;
|
|
266
|
+
var state = {};
|
|
267
|
+
state.longitude = (0, _calculateProgress.progressNumber)(from.longitude, to.longitude, progress);
|
|
268
|
+
state.latitude = (0, _calculateProgress.progressNumber)(from.latitude, to.latitude, progress);
|
|
269
|
+
state.fov = (0, _calculateProgress.progressNumber)(from.fov, to.fov, progress);
|
|
270
|
+
five.setState(state, true);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
var onComplete = function onComplete() {
|
|
274
|
+
resolve(true);
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
var onDestroy = function onDestroy() {
|
|
278
|
+
resolve(false);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
var animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
|
|
282
|
+
var tween = (0, _tween2.tweenProgress)(animeDuration, TWEEN.Easing.Linear.None).onUpdate(onUpdate).onComplete(onComplete).onDestroy(onDestroy);
|
|
283
|
+
|
|
284
|
+
if (args.rotation === _typing.Rotation.Loop) {
|
|
285
|
+
tween.repeat(Infinity).yoyo(true);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 中断回调:可能会被其他动画中断。
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* 中断回调:可能会被其他动画中断。
|
|
294
|
+
*/
|
|
295
|
+
state.interruptCallback = function () {
|
|
296
|
+
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
297
|
+
tween.destroy();
|
|
298
|
+
state.interruptCallback = undefined;
|
|
299
|
+
|
|
300
|
+
if (state.timeoutId) {
|
|
301
|
+
clearTimeout(state.timeoutId);
|
|
302
|
+
state.timeoutId = undefined;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
resolve(flag);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
state.timeoutId = setTimeout(function () {
|
|
309
|
+
// 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
|
|
310
|
+
if (state.interruptCallback) state.interruptCallback(true);
|
|
311
|
+
}, duration);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
case 20:
|
|
315
|
+
return _context2.abrupt("return", _context2.sent);
|
|
316
|
+
|
|
317
|
+
case 21:
|
|
318
|
+
case "end":
|
|
319
|
+
return _context2.stop();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}, _callee2);
|
|
323
|
+
}));
|
|
324
|
+
|
|
325
|
+
return function rotate(_x3, _x4) {
|
|
326
|
+
return _ref2.apply(this, arguments);
|
|
327
|
+
};
|
|
328
|
+
}();
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
move: move,
|
|
332
|
+
rotate: rotate
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
exports.CameraMovementPlugin = CameraMovementPlugin;
|
|
337
|
+
var _default = CameraMovementPlugin;
|
|
338
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Mode, Pose } from '@realsee/five';
|
|
2
|
+
export interface CameraMovementPluginParameterType {
|
|
3
|
+
}
|
|
4
|
+
export interface CameraMovementPluginExportType {
|
|
5
|
+
/**
|
|
6
|
+
* 运镜:移动
|
|
7
|
+
* @param moveArgs 移动参数
|
|
8
|
+
* @param duration 移动耗时
|
|
9
|
+
* @param opts 额外配置
|
|
10
|
+
*/
|
|
11
|
+
move(moveArgs: Partial<MoveArgs>, duration: number, opts?: MoveOpts): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* 运镜:旋转
|
|
14
|
+
* @param rotateArgs 旋转参数
|
|
15
|
+
* @param duration 旋转耗时
|
|
16
|
+
* @param opts 额外配置
|
|
17
|
+
*/
|
|
18
|
+
rotate(rotateArgs: Partial<RotateArgs>, duration: number, opts?: RotateOpts): Promise<boolean>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 运镜效果
|
|
22
|
+
*/
|
|
23
|
+
export declare enum CameraMovementEffect {
|
|
24
|
+
Move = "Move",
|
|
25
|
+
Rotate = "Rotate"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 旋转类型
|
|
29
|
+
*/
|
|
30
|
+
export declare enum Rotation {
|
|
31
|
+
Clockwise = "Clockwise",
|
|
32
|
+
Anticlockwise = "Anticlockwise",
|
|
33
|
+
Loop = "Loop"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 回调配置
|
|
37
|
+
*/
|
|
38
|
+
export interface CameraMovementOptsCallback {
|
|
39
|
+
asyncStartCallback?: () => void;
|
|
40
|
+
asyncEndCallback?: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 移动运镜参数
|
|
44
|
+
*/
|
|
45
|
+
export declare type MoveArgs = {
|
|
46
|
+
mode: Mode;
|
|
47
|
+
panoIndex: number;
|
|
48
|
+
} & Pose;
|
|
49
|
+
/**
|
|
50
|
+
* 移动运镜配置
|
|
51
|
+
*/
|
|
52
|
+
export declare type MoveOpts = {
|
|
53
|
+
preload?: boolean;
|
|
54
|
+
} & CameraMovementOptsCallback;
|
|
55
|
+
/**
|
|
56
|
+
* 旋转运镜参数
|
|
57
|
+
*/
|
|
58
|
+
export declare type RotateArgs = {
|
|
59
|
+
panoIndex?: number;
|
|
60
|
+
rotateSpeed?: number;
|
|
61
|
+
rotation?: Rotation;
|
|
62
|
+
} & Pose;
|
|
63
|
+
/**
|
|
64
|
+
* 旋转运镜配置
|
|
65
|
+
*/
|
|
66
|
+
export declare type RotateOpts = {
|
|
67
|
+
preload?: boolean;
|
|
68
|
+
} & CameraMovementOptsCallback;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Rotation = exports.CameraMovementEffect = void 0;
|
|
7
|
+
// eslint-disable-next-line prettier/prettier
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 运镜效果
|
|
11
|
+
*/
|
|
12
|
+
var CameraMovementEffect;
|
|
13
|
+
/**
|
|
14
|
+
* 旋转类型
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
exports.CameraMovementEffect = CameraMovementEffect;
|
|
18
|
+
|
|
19
|
+
(function (CameraMovementEffect) {
|
|
20
|
+
CameraMovementEffect["Move"] = "Move";
|
|
21
|
+
CameraMovementEffect["Rotate"] = "Rotate";
|
|
22
|
+
})(CameraMovementEffect || (exports.CameraMovementEffect = CameraMovementEffect = {}));
|
|
23
|
+
|
|
24
|
+
var Rotation;
|
|
25
|
+
/**
|
|
26
|
+
* 回调配置
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
exports.Rotation = Rotation;
|
|
30
|
+
|
|
31
|
+
(function (Rotation) {
|
|
32
|
+
Rotation["Clockwise"] = "Clockwise";
|
|
33
|
+
Rotation["Anticlockwise"] = "Anticlockwise";
|
|
34
|
+
Rotation["Loop"] = "Loop";
|
|
35
|
+
})(Rotation || (exports.Rotation = Rotation = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FivePlugin } from '@realsee/five';
|
|
2
|
+
export interface ModelChassisCompassPluginParameterType {
|
|
3
|
+
northRad?: number;
|
|
4
|
+
fbxUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ModelChassisCompassPluginExportType {
|
|
7
|
+
enable: () => void;
|
|
8
|
+
disable: () => void;
|
|
9
|
+
load: (northRad?: number, fbxUrl?: string) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 模型底盘指南针插件
|
|
13
|
+
*/
|
|
14
|
+
declare const ModelChassisCompassPlugin: FivePlugin<ModelChassisCompassPluginParameterType, ModelChassisCompassPluginExportType>;
|
|
15
|
+
export default ModelChassisCompassPlugin;
|