@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,14 @@
|
|
|
1
|
+
import { Five } from '@realsee/five';
|
|
2
|
+
export interface ShowState {
|
|
3
|
+
latitude: number;
|
|
4
|
+
longitude: number;
|
|
5
|
+
fov: number;
|
|
6
|
+
}
|
|
7
|
+
/** 判断当前状态是否可以展示户型图 */
|
|
8
|
+
export declare function checkShowState(five: Five, showState: ShowState): boolean;
|
|
9
|
+
/** 更改 Five 状态到展示户型图的状态
|
|
10
|
+
* 1. 判断状态不符合时,会纠正到正确的状态
|
|
11
|
+
* 2. 内置了相应的动画时间计算
|
|
12
|
+
* 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
|
|
13
|
+
*/
|
|
14
|
+
export default function correctFiveState(five: Five, showState: ShowState, userAction?: boolean): Promise<void>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkShowState = checkShowState;
|
|
7
|
+
exports["default"] = correctFiveState;
|
|
8
|
+
|
|
9
|
+
var _five = require("@realsee/five");
|
|
10
|
+
|
|
11
|
+
var _changeMode = _interopRequireDefault(require("../../../../shared-utils/five/changeMode"));
|
|
12
|
+
|
|
13
|
+
var _constant = require("./constant");
|
|
14
|
+
|
|
15
|
+
var _to = _interopRequireDefault(require("../../../../shared-utils/to"));
|
|
16
|
+
|
|
17
|
+
var _nearlyEqual = _interopRequireDefault(require("../../../../shared-utils/nearlyEqual"));
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
|
+
|
|
21
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
|
+
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
|
|
25
|
+
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); }
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
30
|
+
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
|
|
33
|
+
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); } }
|
|
34
|
+
|
|
35
|
+
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); }); }; }
|
|
36
|
+
|
|
37
|
+
/** 判断当前状态是否可以展示户型图 */
|
|
38
|
+
function checkShowState(five, showState) {
|
|
39
|
+
if (five.currentMode !== _five.Five.Mode.Floorplan) return false;
|
|
40
|
+
var latitude = showState.latitude,
|
|
41
|
+
longitude = showState.longitude,
|
|
42
|
+
fov = showState.fov;
|
|
43
|
+
|
|
44
|
+
var _five$getCurrentState = five.getCurrentState(),
|
|
45
|
+
_latitude = _five$getCurrentState.latitude,
|
|
46
|
+
_longitude = _five$getCurrentState.longitude;
|
|
47
|
+
|
|
48
|
+
var _fov = five.camera.fov;
|
|
49
|
+
if ((0, _nearlyEqual["default"])(latitude, _latitude, 1) && (0, _nearlyEqual["default"])(longitude, _longitude, 1) && fov === _fov) return true;
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
/** 更改 Five 状态到展示户型图的状态
|
|
53
|
+
* 1. 判断状态不符合时,会纠正到正确的状态
|
|
54
|
+
* 2. 内置了相应的动画时间计算
|
|
55
|
+
* 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
function correctFiveState(_x, _x2) {
|
|
60
|
+
return _correctFiveState.apply(this, arguments);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _correctFiveState() {
|
|
64
|
+
_correctFiveState = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(five, showState) {
|
|
65
|
+
var userAction,
|
|
66
|
+
result,
|
|
67
|
+
_yield$to,
|
|
68
|
+
_yield$to2,
|
|
69
|
+
changeModeError,
|
|
70
|
+
_result,
|
|
71
|
+
_five$getCurrentState2,
|
|
72
|
+
latitude,
|
|
73
|
+
longitude,
|
|
74
|
+
fov,
|
|
75
|
+
time,
|
|
76
|
+
_yield$to3,
|
|
77
|
+
_yield$to4,
|
|
78
|
+
updateCameraError,
|
|
79
|
+
_args = arguments;
|
|
80
|
+
|
|
81
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
82
|
+
while (1) {
|
|
83
|
+
switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
userAction = _args.length > 2 && _args[2] !== undefined ? _args[2] : true;
|
|
86
|
+
// 当前已满足状态,不需要变更
|
|
87
|
+
result = checkShowState(five, showState);
|
|
88
|
+
|
|
89
|
+
if (!(result === true)) {
|
|
90
|
+
_context.next = 4;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return _context.abrupt("return");
|
|
95
|
+
|
|
96
|
+
case 4:
|
|
97
|
+
if (!(five.currentMode !== _five.Five.Mode.Floorplan)) {
|
|
98
|
+
_context.next = 16;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_context.next = 7;
|
|
103
|
+
return (0, _to["default"])((0, _changeMode["default"])(five, _five.Five.Mode.Floorplan, showState, undefined, userAction));
|
|
104
|
+
|
|
105
|
+
case 7:
|
|
106
|
+
_yield$to = _context.sent;
|
|
107
|
+
_yield$to2 = _slicedToArray(_yield$to, 1);
|
|
108
|
+
changeModeError = _yield$to2[0];
|
|
109
|
+
|
|
110
|
+
if (!changeModeError) {
|
|
111
|
+
_context.next = 12;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
throw changeModeError;
|
|
116
|
+
|
|
117
|
+
case 12:
|
|
118
|
+
// changeMode 是异步行为,可能会被打断,需要在结束后加一次判断
|
|
119
|
+
_result = checkShowState(five, showState);
|
|
120
|
+
|
|
121
|
+
if (!(_result === false)) {
|
|
122
|
+
_context.next = 15;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
throw new Error(_constant.FloorplanErrorType.ChangeModeError);
|
|
127
|
+
|
|
128
|
+
case 15:
|
|
129
|
+
return _context.abrupt("return");
|
|
130
|
+
|
|
131
|
+
case 16:
|
|
132
|
+
// 纠正相机状态
|
|
133
|
+
// 根据 latitude、longitude、fov 计算动画时间,最多 1s
|
|
134
|
+
_five$getCurrentState2 = five.getCurrentState(), latitude = _five$getCurrentState2.latitude, longitude = _five$getCurrentState2.longitude, fov = _five$getCurrentState2.fov;
|
|
135
|
+
time = Math.min(1000, Math.max(200, Math.abs(latitude - Math.PI / 2) * 1000, (longitude > Math.PI ? 2 * Math.PI - longitude : longitude) * 500, Math.abs(fov - showState.fov) * 10));
|
|
136
|
+
_context.next = 20;
|
|
137
|
+
return (0, _to["default"])(five.updateCamera(showState, time, userAction));
|
|
138
|
+
|
|
139
|
+
case 20:
|
|
140
|
+
_yield$to3 = _context.sent;
|
|
141
|
+
_yield$to4 = _slicedToArray(_yield$to3, 1);
|
|
142
|
+
updateCameraError = _yield$to4[0];
|
|
143
|
+
|
|
144
|
+
if (!updateCameraError) {
|
|
145
|
+
_context.next = 25;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
throw new Error(_constant.FloorplanErrorType.UpdateCameraError);
|
|
150
|
+
|
|
151
|
+
case 25:
|
|
152
|
+
return _context.abrupt("return");
|
|
153
|
+
|
|
154
|
+
case 26:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context.stop();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, _callee);
|
|
160
|
+
}));
|
|
161
|
+
return _correctFiveState.apply(this, arguments);
|
|
162
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Five } from '@realsee/five';
|
|
3
|
+
import { FloorplanData } from '../../typings/floorplanData';
|
|
4
|
+
declare const _default: React.NamedExoticComponent<{
|
|
5
|
+
five: Five;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
floorplanData: FloorplanData;
|
|
9
|
+
cameraImage?: {
|
|
10
|
+
style: React.CSSProperties;
|
|
11
|
+
} | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
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"] = void 0;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _throttle = _interopRequireDefault(require("../../../../shared-utils/throttle"));
|
|
13
|
+
|
|
14
|
+
var _Camera = require("./Camera.style");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var _default = /*#__PURE__*/React.memo(function Camera(props) {
|
|
23
|
+
var _props$cameraImage;
|
|
24
|
+
|
|
25
|
+
var getCameraPositionTransform = function getCameraPositionTransform(panoIndex) {
|
|
26
|
+
var observers = props.floorplanData.observers;
|
|
27
|
+
var observer = observers[panoIndex];
|
|
28
|
+
var left = Math.floor(observer.positionInImage.x * props.width);
|
|
29
|
+
var top = Math.floor(observer.positionInImage.y * props.height);
|
|
30
|
+
return "translate(".concat(left, "px, ").concat(top, "px)");
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var getCameraRotationTransform = function getCameraRotationTransform() {
|
|
34
|
+
var _five$getCurrentState = five.getCurrentState(),
|
|
35
|
+
longitude = _five$getCurrentState.longitude; // 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var rotate = Math.floor(longitude / Math.PI * 180) * -1 + 45;
|
|
39
|
+
return "rotate(".concat(rotate, "deg)");
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var changePosition = function changePosition(panoIndex) {
|
|
43
|
+
if (!cameraPositionDomRef.current) return;
|
|
44
|
+
cameraPositionDomRef.current.style.transform = getCameraPositionTransform(panoIndex);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var changeRotate = (0, _throttle["default"])(function () {
|
|
48
|
+
if (!cameraRotateDomRef.current) return;
|
|
49
|
+
cameraRotateDomRef.current.style.transform = getCameraRotationTransform();
|
|
50
|
+
}, 1000 / 60);
|
|
51
|
+
var five = props.five;
|
|
52
|
+
var cameraPositionDomRef = React.useRef(null);
|
|
53
|
+
var cameraRotateDomRef = React.useRef(null);
|
|
54
|
+
var originPositionStyle = {
|
|
55
|
+
transform: getCameraPositionTransform(five.getCurrentState().panoIndex)
|
|
56
|
+
};
|
|
57
|
+
var originRotationStyle = {
|
|
58
|
+
transform: getCameraRotationTransform()
|
|
59
|
+
};
|
|
60
|
+
React.useEffect(function () {
|
|
61
|
+
var onModelLoaded = function onModelLoaded() {
|
|
62
|
+
changePosition(five.getCurrentState().panoIndex);
|
|
63
|
+
changeRotate();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
changePosition(five.getCurrentState().panoIndex);
|
|
67
|
+
changeRotate();
|
|
68
|
+
five.on('panoWillArrive', changePosition);
|
|
69
|
+
five.on('cameraUpdate', changeRotate);
|
|
70
|
+
five.on('modelLoaded', onModelLoaded);
|
|
71
|
+
return function () {
|
|
72
|
+
five.off('panoWillArrive', changePosition);
|
|
73
|
+
five.off('cameraUpdate', changeRotate);
|
|
74
|
+
five.off('modelLoaded', onModelLoaded);
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
var rotateBaseStyle = Object.assign({}, _Camera.rotateStyle, (_props$cameraImage = props.cameraImage) === null || _props$cameraImage === void 0 ? void 0 : _props$cameraImage.style);
|
|
78
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
ref: cameraPositionDomRef,
|
|
80
|
+
style: Object.assign({}, _Camera.positionStyle, originPositionStyle)
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
ref: cameraRotateDomRef,
|
|
83
|
+
style: Object.assign({}, rotateBaseStyle, originRotationStyle)
|
|
84
|
+
}));
|
|
85
|
+
}, function (prev, next) {
|
|
86
|
+
return Object.keys(prev).every(function (key) {
|
|
87
|
+
return next[key] === prev[key];
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.rotateStyle = exports.positionStyle = void 0;
|
|
7
|
+
|
|
8
|
+
var _px2rem = _interopRequireDefault(require("../../../../shared-utils/px2rem"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var positionStyle = {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
left: '0',
|
|
15
|
+
top: '0',
|
|
16
|
+
width: '0',
|
|
17
|
+
height: '0',
|
|
18
|
+
transform: 'none',
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
transition: 'transform 1s linear'
|
|
21
|
+
};
|
|
22
|
+
exports.positionStyle = positionStyle;
|
|
23
|
+
var rotateStyle = {
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
left: "".concat((0, _px2rem["default"])(-15)),
|
|
26
|
+
top: "".concat((0, _px2rem["default"])(-15)),
|
|
27
|
+
width: "".concat((0, _px2rem["default"])(17)),
|
|
28
|
+
height: "".concat((0, _px2rem["default"])(17)),
|
|
29
|
+
backgroundSize: '100%',
|
|
30
|
+
backgroundRepeat: 'no-repeat',
|
|
31
|
+
transformOrigin: "".concat((0, _px2rem["default"])(15), " ").concat((0, _px2rem["default"])(15)),
|
|
32
|
+
transform: 'rotate(45deg)',
|
|
33
|
+
backgroundImage: "url('//vrlab-static.ljcdn.com/release/web/default-sidemap-camera.5e0b9a1a.png')"
|
|
34
|
+
};
|
|
35
|
+
exports.rotateStyle = rotateStyle;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.ExtraObjects = ExtraObjects;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _px2rem = _interopRequireDefault(require("../../../../../shared-utils/px2rem"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
function ExtraObjects(props) {
|
|
21
|
+
var containerStyle = {
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: '100%',
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
top: '0',
|
|
26
|
+
left: '0',
|
|
27
|
+
pointerEvents: 'none'
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
style: containerStyle
|
|
31
|
+
}, props.extraObjects.map(function (extraObject) {
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
key: extraObject.id,
|
|
34
|
+
style: {
|
|
35
|
+
width: 0,
|
|
36
|
+
height: 0,
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
top: extraObject.positionInImage.y * 100 + '%',
|
|
39
|
+
left: extraObject.positionInImage.x * 100 + '%'
|
|
40
|
+
}
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
style: {
|
|
43
|
+
width: "".concat((0, _px2rem["default"])(extraObject.icon.width)),
|
|
44
|
+
height: "".concat((0, _px2rem["default"])(extraObject.icon.height)),
|
|
45
|
+
backgroundImage: "url(".concat(extraObject.icon.url, ")"),
|
|
46
|
+
transform: 'translate(-50%, -50%)'
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Five } from '@realsee/five';
|
|
3
|
+
import { FloorplanData } from '../../../typings/floorplanData';
|
|
4
|
+
export default function RoomHighlight(props: {
|
|
5
|
+
five: Five;
|
|
6
|
+
pxmm: number;
|
|
7
|
+
floorIndex: number;
|
|
8
|
+
floorplanData: FloorplanData;
|
|
9
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
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"] = RoomHighlight;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _three = require("three");
|
|
13
|
+
|
|
14
|
+
var _formatPosition = _interopRequireWildcard(require("../../../utils/formatPosition"));
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
function RoomHighlight(props) {
|
|
23
|
+
if (!props.five.work || !props.five.model) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
24
|
+
var nowFloorData = props.floorplanData.floorDatas[props.floorIndex];
|
|
25
|
+
var contentDomRef = React.useRef(null);
|
|
26
|
+
var floorplanObservers = props.floorplanData.observers;
|
|
27
|
+
|
|
28
|
+
var handleClick = function handleClick(e) {
|
|
29
|
+
if (!contentDomRef.current) return;
|
|
30
|
+
var boundingClient = contentDomRef.current.getBoundingClientRect(); // 注意 React 对事件做了代理,clientX 和 clientY 不再相对于原 DOM,而是 document
|
|
31
|
+
|
|
32
|
+
var mouseVector = new _three.Vector2(e.clientX, e.clientY);
|
|
33
|
+
var contentOffset = new _three.Vector2(boundingClient.left, boundingClient.top); // 相当于原生 mouseEvent 的 clientX clientY
|
|
34
|
+
|
|
35
|
+
var mouseOriginVector = mouseVector.clone().sub(contentOffset);
|
|
36
|
+
var mouseOffsetVector = new _three.Vector2(mouseOriginVector.x / contentDomRef.current.clientWidth, mouseOriginVector.y / contentDomRef.current.clientHeight);
|
|
37
|
+
var closestPoint = floorplanObservers.filter(function (observer) {
|
|
38
|
+
return observer.floorIndex === props.floorIndex;
|
|
39
|
+
}).sort(function (ob1, ob2) {
|
|
40
|
+
var position1 = new _three.Vector2(ob1.positionInImage.x, ob1.positionInImage.y);
|
|
41
|
+
var position2 = new _three.Vector2(ob2.positionInImage.x, ob2.positionInImage.y);
|
|
42
|
+
return position1.distanceTo(mouseOffsetVector) - position2.distanceTo(mouseOffsetVector);
|
|
43
|
+
})[0];
|
|
44
|
+
props.five.moveToPano(closestPoint.index);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var highlightStyle = {
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
width: '100%',
|
|
50
|
+
height: '100%',
|
|
51
|
+
pointerEvents: 'all'
|
|
52
|
+
};
|
|
53
|
+
var svgStyle = {
|
|
54
|
+
width: '100%',
|
|
55
|
+
height: '100%',
|
|
56
|
+
overflow: 'visible'
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
ref: contentDomRef,
|
|
60
|
+
className: "floorplan-plugin__room-highlight",
|
|
61
|
+
style: highlightStyle,
|
|
62
|
+
onClick: handleClick
|
|
63
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
64
|
+
style: svgStyle
|
|
65
|
+
}, nowFloorData.rooms.map(function (room) {
|
|
66
|
+
return /*#__PURE__*/React.createElement(Room, _extends({
|
|
67
|
+
key: room.id
|
|
68
|
+
}, props, {
|
|
69
|
+
data: room
|
|
70
|
+
}));
|
|
71
|
+
})));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function Room(props) {
|
|
75
|
+
var bounding = props.floorplanData.bounding;
|
|
76
|
+
|
|
77
|
+
var _pathD = (0, _formatPosition.pathD)(props.data.path, {
|
|
78
|
+
needZ: true,
|
|
79
|
+
format: function format(vector) {
|
|
80
|
+
return (0, _formatPosition["default"])(vector, props.pxmm, bounding);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var pathElement = React.useRef(null);
|
|
85
|
+
|
|
86
|
+
var handleMouseOver = function handleMouseOver() {
|
|
87
|
+
pathElement.current && (pathElement.current.style.opacity = '0.1');
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var handleMouseOut = function handleMouseOut() {
|
|
91
|
+
pathElement.current && (pathElement.current.style.opacity = '0');
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return /*#__PURE__*/React.createElement("path", {
|
|
95
|
+
ref: pathElement,
|
|
96
|
+
d: _pathD,
|
|
97
|
+
fill: "#000",
|
|
98
|
+
opacity: 0,
|
|
99
|
+
onMouseOver: handleMouseOver,
|
|
100
|
+
onMouseOut: handleMouseOut
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Five } from '@realsee/five';
|
|
3
|
+
import { FloorplanData, FloorplanExtraObject } from '../../../typings/floorplanData';
|
|
4
|
+
export default function NowFloor(props: {
|
|
5
|
+
five: Five;
|
|
6
|
+
pxmm: number;
|
|
7
|
+
floorIndex: number;
|
|
8
|
+
hoverEnable?: boolean;
|
|
9
|
+
extraObjects?: FloorplanExtraObject[];
|
|
10
|
+
floorplanData: FloorplanData;
|
|
11
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
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"] = NowFloor;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _RoomHighlight = _interopRequireDefault(require("./RoomHighlight"));
|
|
13
|
+
|
|
14
|
+
var _FloorplanImage = _interopRequireDefault(require("../../../components/FloorplanImage"));
|
|
15
|
+
|
|
16
|
+
var _ExtraObjects = require("./ExtraObjects");
|
|
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
|
|
26
|
+
function NowFloor(props) {
|
|
27
|
+
var _props$extraObjects;
|
|
28
|
+
|
|
29
|
+
var nowFloorStyle = {
|
|
30
|
+
position: 'relative',
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: '100%'
|
|
33
|
+
};
|
|
34
|
+
var nowFloorExtraObjects = props === null || props === void 0 ? void 0 : (_props$extraObjects = props.extraObjects) === null || _props$extraObjects === void 0 ? void 0 : _props$extraObjects.filter(function (object) {
|
|
35
|
+
return object.floorIndex === props.floorIndex;
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
style: nowFloorStyle
|
|
39
|
+
}, /*#__PURE__*/React.createElement(_FloorplanImage["default"], props), nowFloorExtraObjects && /*#__PURE__*/React.createElement(_ExtraObjects.ExtraObjects, {
|
|
40
|
+
extraObjects: nowFloorExtraObjects
|
|
41
|
+
}), props.hoverEnable && /*#__PURE__*/React.createElement(_RoomHighlight["default"], _extends({}, props, props.floorplanData)));
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FloorplanData, FloorplanExtraObject } from '../../typings/floorplanData';
|
|
3
|
+
import type { Five } from '@realsee/five';
|
|
4
|
+
export interface Props {
|
|
5
|
+
five: Five;
|
|
6
|
+
pxmm: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
hoverEnable?: boolean;
|
|
10
|
+
floorplanData: FloorplanData;
|
|
11
|
+
extraObjects?: FloorplanExtraObject[];
|
|
12
|
+
cameraImage?: {
|
|
13
|
+
style: React.CSSProperties;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const _default: React.NamedExoticComponent<Props>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
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"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _Camera = _interopRequireDefault(require("./Camera"));
|
|
11
|
+
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _NowFloor = _interopRequireDefault(require("./NowFloor"));
|
|
15
|
+
|
|
16
|
+
var _index = require("./index.style");
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
24
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
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
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
var _default = /*#__PURE__*/React.memo(function Content(props) {
|
|
39
|
+
if (!props.floorplanData) return null;
|
|
40
|
+
var five = props.five;
|
|
41
|
+
var panoIndex = five.getCurrentState().panoIndex;
|
|
42
|
+
var observers = five.work.observers;
|
|
43
|
+
|
|
44
|
+
var _React$useState = React.useState(observers[panoIndex].floorIndex),
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
floorIndex = _React$useState2[0],
|
|
47
|
+
changeFloorIndex = _React$useState2[1];
|
|
48
|
+
|
|
49
|
+
var sizeStyle = {
|
|
50
|
+
width: props.width + 'px',
|
|
51
|
+
height: props.height + 'px'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var handlePanoArrived = function handlePanoArrived(panoIndex) {
|
|
55
|
+
changeFloorIndex(observers[panoIndex].floorIndex);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
React.useEffect(function () {
|
|
59
|
+
five.on('panoArrived', handlePanoArrived);
|
|
60
|
+
return function () {
|
|
61
|
+
five.off('panoArrived', handlePanoArrived);
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
style: Object.assign({}, _index.contentStyle, sizeStyle)
|
|
66
|
+
}, /*#__PURE__*/React.createElement(_NowFloor["default"], _extends({}, props, {
|
|
67
|
+
floorIndex: floorIndex
|
|
68
|
+
})), /*#__PURE__*/React.createElement(_Camera["default"], props));
|
|
69
|
+
}, function (prev, next) {
|
|
70
|
+
return Object.keys(prev).every(function (key) {
|
|
71
|
+
return next[key] === prev[key];
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
exports["default"] = _default;
|