@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.
Files changed (271) hide show
  1. package/README.md +94 -0
  2. package/TERMS.txt +56 -0
  3. package/components/ARVideoFigure/ARVideoFigureMesh.d.ts +44 -0
  4. package/components/ARVideoFigure/ARVideoFigureMesh.js +347 -0
  5. package/components/ARVideoFigure/ARVideoFigureScene.d.ts +11 -0
  6. package/components/ARVideoFigure/ARVideoFigureScene.js +74 -0
  7. package/components/ARVideoFigure/ImgBgTransparent.d.ts +16 -0
  8. package/components/ARVideoFigure/ImgBgTransparent.js +49 -0
  9. package/components/ARVideoFigure/ImgBgTransparentMesh.d.ts +30 -0
  10. package/components/ARVideoFigure/ImgBgTransparentMesh.js +173 -0
  11. package/components/ARVideoFigure/fragmentShader.d.ts +5 -0
  12. package/components/ARVideoFigure/fragmentShader.js +16 -0
  13. package/components/ARVideoFigure/index.d.ts +15 -0
  14. package/components/ARVideoFigure/index.js +64 -0
  15. package/components/ARVideoFigure/vertexShader.d.ts +1 -0
  16. package/components/ARVideoFigure/vertexShader.js +8 -0
  17. package/components/GlassFilters/index.d.ts +32 -0
  18. package/components/GlassFilters/index.js +54 -0
  19. package/components/ModelView/ModelViewController.d.ts +18 -0
  20. package/components/ModelView/ModelViewController.js +147 -0
  21. package/components/ModelView/index.d.ts +10 -0
  22. package/components/ModelView/index.js +22 -0
  23. package/components/PBRView/index.d.ts +14 -0
  24. package/components/PBRView/index.js +31 -0
  25. package/components/PaintBrush/index.d.ts +16 -0
  26. package/components/PaintBrush/index.js +33 -0
  27. package/components/PanoTag/index.d.ts +4 -0
  28. package/components/PanoTag/index.js +11 -0
  29. package/custom.d.js +3 -0
  30. package/data/1aGKl9JmrlXMXx8d.d.ts +104 -0
  31. package/data/1aGKl9JmrlXMXx8d.js +535 -0
  32. package/data/6gyq3v1verxD7JO1.d.ts +104 -0
  33. package/data/6gyq3v1verxD7JO1.js +460 -0
  34. package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.d.ts +84 -0
  35. package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +598 -0
  36. package/data/PrXel3aqGbp34JQn.d.ts +389 -0
  37. package/data/PrXel3aqGbp34JQn.js +4639 -0
  38. package/data/YdoNP9K4rwQDwjJr.d.ts +83 -0
  39. package/data/YdoNP9K4rwQDwjJr.js +1451 -0
  40. package/data/auto3d-njL5J99VwCmnjtQElOmXQr.d.ts +86 -0
  41. package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +709 -0
  42. package/data/oPzy3ApbjjpD8YdR.d.ts +83 -0
  43. package/data/oPzy3ApbjjpD8YdR.js +281 -0
  44. package/data/qjAxMG4XbPn96wKG.d.ts +104 -0
  45. package/data/qjAxMG4XbPn96wKG.js +635 -0
  46. package/data/rXel3aPQRRBD4JQn.d.ts +86 -0
  47. package/data/rXel3aPQRRBD4JQn.js +620 -0
  48. package/data/vLykj3NWrllMrG06.d.ts +89 -0
  49. package/data/vLykj3NWrllMrG06.js +2532 -0
  50. package/data/wYnRjQ4KZoV1yPoG.d.ts +114 -0
  51. package/data/wYnRjQ4KZoV1yPoG.js +512 -0
  52. package/data/wz0QV9KA4ugyo9ME.d.ts +39 -0
  53. package/data/wz0QV9KA4ugyo9ME.js +134 -0
  54. package/examples/FiveStateController/index.js +140 -0
  55. package/examples/VRHouse/Mobile.js +22 -0
  56. package/examples/VRHouse/PC.js +22 -0
  57. package/examples/VRHouse/index.js +22 -0
  58. package/index.d.ts +15 -0
  59. package/index.js +43 -0
  60. package/package.json +19 -0
  61. package/plugins/CSS3DRenderPlugin/components/Marker/index.d.ts +12 -0
  62. package/plugins/CSS3DRenderPlugin/components/Marker/index.js +113 -0
  63. package/plugins/CSS3DRenderPlugin/index.d.ts +49 -0
  64. package/plugins/CSS3DRenderPlugin/index.js +220 -0
  65. package/plugins/CameraMovementPlugin/index.d.ts +7 -0
  66. package/plugins/CameraMovementPlugin/index.js +338 -0
  67. package/plugins/CameraMovementPlugin/typing.d.ts +68 -0
  68. package/plugins/CameraMovementPlugin/typing.js +35 -0
  69. package/plugins/ModelChassisCompassPlugin/index.d.ts +15 -0
  70. package/plugins/ModelChassisCompassPlugin/index.js +156 -0
  71. package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +10 -0
  72. package/plugins/ModelEntryDoorGuidePlugin/index.js +16 -0
  73. package/plugins/ModelTVVideoPlugin/index.d.ts +21 -0
  74. package/plugins/ModelTVVideoPlugin/index.js +313 -0
  75. package/plugins/ModelViewPlugin/index.d.ts +17 -0
  76. package/plugins/ModelViewPlugin/index.js +199 -0
  77. package/plugins/PanoCursorRaycasterPlugin/PanoCursorRaycasterPluginUsage.d.ts +48 -0
  78. package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.d.ts +9 -0
  79. package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +113 -0
  80. package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.d.ts +11 -0
  81. package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +25 -0
  82. package/plugins/PanoCursorRaycasterPlugin/index.d.ts +49 -0
  83. package/plugins/PanoCursorRaycasterPlugin/index.js +119 -0
  84. package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.d.ts +5 -0
  85. package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +25 -0
  86. package/plugins/PanoCursorRaycasterPlugin/utils/createLine.d.ts +3 -0
  87. package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +34 -0
  88. package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.d.ts +7 -0
  89. package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.js +18 -0
  90. package/plugins/PanoDoorLabelPlugin/index.d.ts +4 -0
  91. package/plugins/PanoDoorLabelPlugin/index.js +12 -0
  92. package/plugins/PanoIRobotPlugin/index.d.ts +10 -0
  93. package/plugins/PanoIRobotPlugin/index.js +16 -0
  94. package/plugins/PanoRulerPlugin/data/roomInfo.d.ts +3 -0
  95. package/plugins/PanoRulerPlugin/data/roomInfo.js +49 -0
  96. package/plugins/PanoRulerPlugin/data/roomRules.d.ts +3 -0
  97. package/plugins/PanoRulerPlugin/data/roomRules.js +233 -0
  98. package/plugins/PanoRulerPlugin/index.d.ts +27 -0
  99. package/plugins/PanoRulerPlugin/index.js +589 -0
  100. package/plugins/PanoRulerPlugin/typings.d.ts +21 -0
  101. package/plugins/PanoRulerPlugin/typings.js +5 -0
  102. package/plugins/PanoTVVideoPlugin/index.d.ts +24 -0
  103. package/plugins/PanoTVVideoPlugin/index.js +351 -0
  104. package/plugins/TreasurePlugin/Controller.d.ts +32 -0
  105. package/plugins/TreasurePlugin/Controller.js +175 -0
  106. package/plugins/TreasurePlugin/TreasureFaceAnime.d.ts +23 -0
  107. package/plugins/TreasurePlugin/TreasureFaceAnime.js +128 -0
  108. package/plugins/TreasurePlugin/TreasureObject.d.ts +35 -0
  109. package/plugins/TreasurePlugin/TreasureObject.js +186 -0
  110. package/plugins/TreasurePlugin/TreasureOpenAnime.d.ts +23 -0
  111. package/plugins/TreasurePlugin/TreasureOpenAnime.js +103 -0
  112. package/plugins/TreasurePlugin/constants.d.ts +12 -0
  113. package/plugins/TreasurePlugin/constants.js +30 -0
  114. package/plugins/TreasurePlugin/index.d.ts +11 -0
  115. package/plugins/TreasurePlugin/index.js +16 -0
  116. package/plugins/TreasurePlugin/treasureDataMap.d.ts +7 -0
  117. package/plugins/TreasurePlugin/treasureDataMap.js +20 -0
  118. package/plugins/TreasurePlugin/typings.d.ts +2 -0
  119. package/plugins/TreasurePlugin/typings.js +5 -0
  120. package/plugins/TreasurePlugin/utils/loadTreasureTextures.d.ts +7 -0
  121. package/plugins/TreasurePlugin/utils/loadTreasureTextures.js +115 -0
  122. package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -0
  123. package/plugins/floorplan/Assets/floorplanExtraObject.js +8 -0
  124. package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +100 -0
  125. package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +643 -0
  126. package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.d.ts +13 -0
  127. package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +58 -0
  128. package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.d.ts +5 -0
  129. package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +69 -0
  130. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.d.ts +10 -0
  131. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +105 -0
  132. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.d.ts +13 -0
  133. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +95 -0
  134. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +13 -0
  135. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +48 -0
  136. package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +20 -0
  137. package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +66 -0
  138. package/plugins/floorplan/ModelFloorplanPlugin/controller.style.d.ts +1 -0
  139. package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +14 -0
  140. package/plugins/floorplan/ModelFloorplanPlugin/index.d.ts +9 -0
  141. package/plugins/floorplan/ModelFloorplanPlugin/index.js +18 -0
  142. package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +23 -0
  143. package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +5 -0
  144. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +15 -0
  145. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +31 -0
  146. package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.d.ts +14 -0
  147. package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +162 -0
  148. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.d.ts +13 -0
  149. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +91 -0
  150. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.d.ts +3 -0
  151. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +35 -0
  152. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.d.ts +5 -0
  153. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +50 -0
  154. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.d.ts +9 -0
  155. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +102 -0
  156. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.d.ts +11 -0
  157. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +42 -0
  158. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.d.ts +17 -0
  159. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +75 -0
  160. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.d.ts +2 -0
  161. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +13 -0
  162. package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +33 -0
  163. package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +214 -0
  164. package/plugins/floorplan/PanoFloorplanRadarPlugin/index.d.ts +8 -0
  165. package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +18 -0
  166. package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +55 -0
  167. package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +267 -0
  168. package/plugins/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -0
  169. package/plugins/floorplan/TopviewFloorplanPlugin/index.js +16 -0
  170. package/plugins/floorplan/TopviewFloorplanPlugin/style.d.ts +1 -0
  171. package/plugins/floorplan/TopviewFloorplanPlugin/style.js +14 -0
  172. package/plugins/floorplan/components/FloorplanImage.d.ts +7 -0
  173. package/plugins/floorplan/components/FloorplanImage.js +76 -0
  174. package/plugins/floorplan/typings/floorplanData.d.ts +127 -0
  175. package/plugins/floorplan/typings/floorplanData.js +5 -0
  176. package/plugins/floorplan/typings/floorplanServerData.d.ts +125 -0
  177. package/plugins/floorplan/typings/floorplanServerData.js +380 -0
  178. package/plugins/floorplan/utils/formatData.d.ts +5 -0
  179. package/plugins/floorplan/utils/formatData.js +220 -0
  180. package/plugins/floorplan/utils/formatPosition.d.ts +37 -0
  181. package/plugins/floorplan/utils/formatPosition.js +87 -0
  182. package/shared-utils/Preloader.d.ts +6 -0
  183. package/shared-utils/Preloader.js +51 -0
  184. package/shared-utils/Subscribe.d.ts +45 -0
  185. package/shared-utils/Subscribe.js +210 -0
  186. package/shared-utils/animationFrame/BetterTween.d.ts +11 -0
  187. package/shared-utils/animationFrame/BetterTween.js +102 -0
  188. package/shared-utils/animationFrame/calculateProgress.d.ts +8 -0
  189. package/shared-utils/animationFrame/calculateProgress.js +38 -0
  190. package/shared-utils/animationFrame/formatRad.d.ts +15 -0
  191. package/shared-utils/animationFrame/formatRad.js +34 -0
  192. package/shared-utils/animationFrame/index.d.ts +15 -0
  193. package/shared-utils/animationFrame/index.js +69 -0
  194. package/shared-utils/animationFrame/tween.d.ts +75 -0
  195. package/shared-utils/animationFrame/tween.js +76 -0
  196. package/shared-utils/changeModelCanvansOpacity.d.ts +2 -0
  197. package/shared-utils/changeModelCanvansOpacity.js +24 -0
  198. package/shared-utils/createFiveContainer.d.ts +10 -0
  199. package/shared-utils/createFiveContainer.js +165 -0
  200. package/shared-utils/createLine/index.d.ts +3 -0
  201. package/shared-utils/createLine/index.js +29 -0
  202. package/shared-utils/debounce.d.ts +6 -0
  203. package/shared-utils/debounce.js +26 -0
  204. package/shared-utils/equal.d.ts +11 -0
  205. package/shared-utils/equal.js +96 -0
  206. package/shared-utils/filter.d.ts +27 -0
  207. package/shared-utils/filter.js +93 -0
  208. package/shared-utils/five/changeMode.d.ts +2 -0
  209. package/shared-utils/five/changeMode.js +86 -0
  210. package/shared-utils/five/useFivePlugin.d.ts +1 -0
  211. package/shared-utils/five/useFivePlugin.js +15 -0
  212. package/shared-utils/formatRad.d.ts +7 -0
  213. package/shared-utils/formatRad.js +16 -0
  214. package/shared-utils/getPxmm.d.ts +6 -0
  215. package/shared-utils/getPxmm.js +37 -0
  216. package/shared-utils/getRandomColor.d.ts +1 -0
  217. package/shared-utils/getRandomColor.js +13 -0
  218. package/shared-utils/isTruelyObject.d.ts +18 -0
  219. package/shared-utils/isTruelyObject.js +27 -0
  220. package/shared-utils/math/evenNumber.d.ts +1 -0
  221. package/shared-utils/math/evenNumber.js +11 -0
  222. package/shared-utils/math/planimetry.d.ts +116 -0
  223. package/shared-utils/math/planimetry.js +342 -0
  224. package/shared-utils/math/rad2Deg.d.ts +1 -0
  225. package/shared-utils/math/rad2Deg.js +10 -0
  226. package/shared-utils/nearlyEqual.d.ts +7 -0
  227. package/shared-utils/nearlyEqual.js +17 -0
  228. package/shared-utils/nextFrame.d.ts +1 -0
  229. package/shared-utils/nextFrame.js +13 -0
  230. package/shared-utils/noop.d.ts +5 -0
  231. package/shared-utils/noop.js +17 -0
  232. package/shared-utils/object3d2LocalMatrix.d.ts +12 -0
  233. package/shared-utils/object3d2LocalMatrix.js +73 -0
  234. package/shared-utils/px2rem.d.ts +1 -0
  235. package/shared-utils/px2rem.js +12 -0
  236. package/shared-utils/tap.d.ts +8 -0
  237. package/shared-utils/tap.js +19 -0
  238. package/shared-utils/three/centerPoint.d.ts +2 -0
  239. package/shared-utils/three/centerPoint.js +12 -0
  240. package/shared-utils/three/getNormal.d.ts +2 -0
  241. package/shared-utils/three/getNormal.js +13 -0
  242. package/shared-utils/three/loadFbxObj.d.ts +3 -0
  243. package/shared-utils/three/loadFbxObj.js +42 -0
  244. package/shared-utils/three/loadTexture.d.ts +2 -0
  245. package/shared-utils/three/loadTexture.js +38 -0
  246. package/shared-utils/three/vecror3.d.ts +7 -0
  247. package/shared-utils/three/vecror3.js +18 -0
  248. package/shared-utils/throttle.d.ts +7 -0
  249. package/shared-utils/throttle.js +25 -0
  250. package/shared-utils/to.d.ts +9 -0
  251. package/shared-utils/to.js +25 -0
  252. package/shared-utils/useDebounce.d.ts +8 -0
  253. package/shared-utils/useDebounce.js +43 -0
  254. package/shared-utils/useThrottle.d.ts +8 -0
  255. package/shared-utils/useThrottle.js +41 -0
  256. package/shared-utils/uuid.d.ts +4 -0
  257. package/shared-utils/uuid.js +20 -0
  258. package/shared-utils/vectorTocoordinates.d.ts +7 -0
  259. package/shared-utils/vectorTocoordinates.js +16 -0
  260. package/typedoc/components.d.ts +6 -0
  261. package/typedoc/components.js +5 -0
  262. package/typedoc/plugins.d.ts +17 -0
  263. package/typedoc/plugins.js +113 -0
  264. package/typedoc/shared-utils.d.ts +3 -0
  265. package/typedoc/shared-utils.js +5 -0
  266. package/typedoc/typings.d.ts +3 -0
  267. package/typedoc/typings.js +5 -0
  268. package/typings/math.type.d.ts +44 -0
  269. package/typings/math.type.js +5 -0
  270. package/typings/utils.type.d.ts +2 -0
  271. package/typings/utils.type.js +5 -0
@@ -0,0 +1,589 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.PanoRulerPlugin = void 0;
7
+
8
+ var _five = require("@realsee/five");
9
+
10
+ var _three = require("three");
11
+
12
+ var _planimetry = require("../../shared-utils/math/planimetry");
13
+
14
+ var _nextFrame = require("../../shared-utils/nextFrame");
15
+
16
+ var _throttle = _interopRequireDefault(require("../../shared-utils/throttle"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ 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); } }
21
+
22
+ 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); }); }; }
23
+
24
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
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 getDistance = function getDistance(p1, p2) {
39
+ return Math.sqrt(Math.pow(p1.z - p2.z, 2) + Math.pow(p1.x - p2.x, 2));
40
+ };
41
+
42
+ var getRoomHeightInfo = function getRoomHeightInfo(roomInfo, five) {
43
+ var roomHeightInfo = {};
44
+ var raycaster = new _three.Raycaster();
45
+ var work = five.work;
46
+ if (!work) return roomHeightInfo;
47
+ var observers = roomInfo.observers;
48
+ work.observers.forEach(function (observer, index) {
49
+ var position = observer.standingPosition;
50
+ var point = new _three.Vector3(position.x, position.y, position.z);
51
+ raycaster.set(point, new _three.Vector3(0, 1, 0));
52
+
53
+ var _five$model$intersect = five.model.intersectRaycaster(raycaster),
54
+ _five$model$intersect2 = _slicedToArray(_five$model$intersect, 1),
55
+ intersection = _five$model$intersect2[0];
56
+
57
+ var verticalY = intersection ? intersection.point.y : null;
58
+ var id = observers[index];
59
+ if (!id) return roomHeightInfo;
60
+ var observerRoomName = roomInfo.rooms[id].name;
61
+
62
+ if (roomHeightInfo[observerRoomName] === undefined) {
63
+ roomHeightInfo[observerRoomName] = {
64
+ __roof: [verticalY],
65
+ __floor: [point.y]
66
+ };
67
+ } else {
68
+ roomHeightInfo[observerRoomName].__roof.push(verticalY);
69
+
70
+ roomHeightInfo[observerRoomName].__floor.push(point.y);
71
+ }
72
+ }); // 地板高度求中位数,屋顶高度取最高
73
+
74
+ for (var roomName in roomHeightInfo) {
75
+ var room = roomHeightInfo[roomName];
76
+
77
+ room.__roof.sort();
78
+
79
+ room.__floor.sort();
80
+
81
+ room.floor = room.__floor[~~(room.__floor.length / 2)];
82
+ room.roof = room.__roof[room.__roof.length - 1];
83
+ }
84
+
85
+ return roomHeightInfo;
86
+ };
87
+
88
+ /**
89
+ * 全景标尺插件
90
+ */
91
+ var PanoRulerPlugin = function PanoRulerPlugin(five, params) {
92
+ var state = {
93
+ enable: false,
94
+ loaded: false,
95
+ options: params.options || {
96
+ distanceText: function distanceText(distance) {
97
+ return "\u7EA6".concat(distance.toFixed(1), "\u7C73");
98
+ }
99
+ }
100
+ };
101
+
102
+ var tpl = function tpl(name, distance) {
103
+ var domStr = "\n <div class=\"PanoRulerPlugin-rule-line\">\n <em></em>\n <div class=\"PanoRulerPlugin-rule-label\">\n <div class=\"PanoRulerPlugin-rule-label-point\"></div>\n <span class=\"PanoRulerPlugin-rule-label-name\">".concat(state.options.distanceText(distance), "</span>\n </div>\n </div>\n ");
104
+ var res = document.createElement('div');
105
+ res.setAttribute('class', 'PanoRulerPlugin-rule');
106
+ res.setAttribute('data-name', name);
107
+ res.setAttribute('style', 'display: none');
108
+ res.innerHTML = domStr;
109
+ return res;
110
+ };
111
+
112
+ var $rule = document.createElement('div');
113
+ $rule.setAttribute('style', "position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");
114
+ var __rule = {};
115
+
116
+ var _load = function _load(roomInfo, roomRules) {
117
+ if (state.loaded) {
118
+ throw new Error('标尺被重复初始化!');
119
+ }
120
+
121
+ var roomHeightInfo = getRoomHeightInfo(roomInfo, five);
122
+ var work = five.work;
123
+ if (!work) return false;
124
+
125
+ var _loop = function _loop(obKey) {
126
+ var points = roomRules[obKey];
127
+ var defaultPosition = work.observers[0].standingPosition;
128
+ var roomPoints = points.map(function (_ref) {
129
+ var x = _ref.x,
130
+ z = _ref.z,
131
+ observers = _ref.observers;
132
+ var pointRoomName = observers.length > 0 ? roomInfo.rooms[roomInfo.observers[observers[0]]].name : '';
133
+ var medianFloorHeight = roomHeightInfo[pointRoomName] ? roomHeightInfo[pointRoomName].floor : null;
134
+ var minDistance = Infinity;
135
+ var nearestPoint = {
136
+ index: 0,
137
+ x: defaultPosition.x,
138
+ y: defaultPosition.y,
139
+ z: defaultPosition.z
140
+ };
141
+ observers.forEach(function (index) {
142
+ var position = work.observers[index].standingPosition;
143
+ var observerPoint = {
144
+ index: index,
145
+ x: position.x,
146
+ y: position.y,
147
+ z: position.z
148
+ };
149
+ var distance = getDistance({
150
+ x: x,
151
+ z: z
152
+ }, observerPoint);
153
+
154
+ if (medianFloorHeight) {
155
+ // 取最近点时排除高度与房间平均高度差大于0.3米的点
156
+ if (distance < minDistance && Math.abs(observerPoint.y - medianFloorHeight) < 0.3) {
157
+ minDistance = distance;
158
+ nearestPoint = observerPoint;
159
+ }
160
+ } else {
161
+ if (distance < minDistance) {
162
+ minDistance = distance;
163
+ nearestPoint = observerPoint;
164
+ }
165
+ }
166
+ });
167
+
168
+ var _origin = new _three.Vector3(x, nearestPoint.y, z);
169
+
170
+ Object.assign(_origin, {
171
+ observers: observers
172
+ });
173
+ var verticalY = roomHeightInfo[pointRoomName] ? roomHeightInfo[pointRoomName].roof : null;
174
+
175
+ var _vertical = !verticalY ? null : new _three.Vector3(x, verticalY, z);
176
+
177
+ if (_vertical) Object.assign(_vertical, {
178
+ observers: observers
179
+ });
180
+ var origin = _origin;
181
+ var vertical = _vertical;
182
+ return {
183
+ origin: origin,
184
+ vertical: vertical
185
+ };
186
+ });
187
+ __rule[obKey] = {
188
+ origins: roomPoints.map(function (roomPoint) {
189
+ return roomPoint.origin;
190
+ }),
191
+ rules: []
192
+ };
193
+
194
+ var _iterator = _createForOfIteratorHelper(roomPoints),
195
+ _step;
196
+
197
+ try {
198
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
199
+ var _step$value = _step.value,
200
+ _origin2 = _step$value.origin,
201
+ vertical = _step$value.vertical;
202
+ if (!vertical) continue;
203
+
204
+ var _$element = tpl(obKey, _origin2.distanceTo(vertical));
205
+
206
+ $rule.append(_$element);
207
+
208
+ __rule[obKey].rules.push({
209
+ vertical: true,
210
+ rule: [_origin2, vertical],
211
+ $element: _$element
212
+ });
213
+ }
214
+ } catch (err) {
215
+ _iterator.e(err);
216
+ } finally {
217
+ _iterator.f();
218
+ }
219
+
220
+ for (var index = 0; index < roomPoints.length; index++) {
221
+ var nextIndex = index + 1;
222
+ if (nextIndex >= roomPoints.length) nextIndex = 0;
223
+ var origin = roomPoints[index].origin;
224
+ var next = roomPoints[nextIndex].origin;
225
+ var $element = tpl(obKey, origin.distanceTo(next));
226
+ $rule.append($element);
227
+
228
+ __rule[obKey].rules.push({
229
+ vertical: false,
230
+ rule: [origin, next],
231
+ $element: $element
232
+ });
233
+ }
234
+ };
235
+
236
+ for (var obKey in roomRules) {
237
+ _loop(obKey);
238
+ }
239
+
240
+ state.loaded = true;
241
+ return true;
242
+ };
243
+
244
+ var load = /*#__PURE__*/function () {
245
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_roomInfo, _roomRules, options) {
246
+ var roomInfo, roomRules;
247
+ return regeneratorRuntime.wrap(function _callee$(_context) {
248
+ while (1) {
249
+ switch (_context.prev = _context.next) {
250
+ case 0:
251
+ roomInfo = _roomInfo || params.roomInfo;
252
+ roomRules = _roomRules || params.roomRules;
253
+
254
+ if (!(!roomInfo || !roomRules)) {
255
+ _context.next = 4;
256
+ break;
257
+ }
258
+
259
+ throw new Error('标尺数据依赖不齐全!');
260
+
261
+ case 4:
262
+ state.options = Object.assign({}, state.options, options || {});
263
+
264
+ if (!five.model.loaded) {
265
+ _context.next = 9;
266
+ break;
267
+ }
268
+
269
+ return _context.abrupt("return", _load(roomInfo, roomRules));
270
+
271
+ case 9:
272
+ _context.next = 11;
273
+ return new Promise(function (resolve) {
274
+ return five.once('modelLoaded', function () {
275
+ return resolve(_load(roomInfo, roomRules));
276
+ });
277
+ });
278
+
279
+ case 11:
280
+ return _context.abrupt("return", _context.sent);
281
+
282
+ case 12:
283
+ case "end":
284
+ return _context.stop();
285
+ }
286
+ }
287
+ }, _callee);
288
+ }));
289
+
290
+ return function load(_x, _x2, _x3) {
291
+ return _ref2.apply(this, arguments);
292
+ };
293
+ }();
294
+
295
+ if (params.roomInfo && params.roomRules) {
296
+ load(params.roomInfo, params.roomRules);
297
+ }
298
+
299
+ var getRuleScreenIntr = function getRuleScreenIntr(startPoint, endPoint, canvasWidth, canvasHeight) {
300
+ var screenLines = [[{
301
+ x: 0,
302
+ y: 0
303
+ }, {
304
+ x: canvasWidth,
305
+ y: 0
306
+ }], [{
307
+ x: 0,
308
+ y: 0
309
+ }, {
310
+ x: 0,
311
+ y: canvasHeight
312
+ }], [{
313
+ x: canvasWidth,
314
+ y: 0
315
+ }, {
316
+ x: canvasWidth,
317
+ y: canvasHeight
318
+ }], [{
319
+ x: 0,
320
+ y: canvasHeight
321
+ }, {
322
+ x: canvasWidth,
323
+ y: canvasHeight
324
+ }]];
325
+ var intr = [];
326
+
327
+ for (var i = 0; i < screenLines.length; i++) {
328
+ var result = (0, _planimetry.intersectionOfLine)([startPoint, endPoint], [screenLines[i][0], screenLines[i][1]], true);
329
+ if (result) intr.push(result);
330
+ }
331
+
332
+ if (intr.length === 0) return false;else {
333
+ return intr;
334
+ }
335
+ };
336
+
337
+ var freshRule = function freshRule() {
338
+ var element = five.getElement();
339
+ if (!element) return;
340
+ if (!state.loaded) return;
341
+ if (Object.keys(__rule).length <= 0) return;
342
+ var panoIndex = five.panoIndex,
343
+ camera = five.camera,
344
+ currentMode = five.currentMode;
345
+ if (panoIndex === undefined) return;
346
+ var name;
347
+
348
+ for (var _name in __rule) {
349
+ if (_name.split(',').indexOf(panoIndex.toString()) >= 0) name = _name;
350
+ }
351
+
352
+ if (!name) return;
353
+ var cameraPosition = camera.position;
354
+ var cameraDirection = camera.getWorldDirection(new _three.Vector3());
355
+ var width = element.width;
356
+ var height = element.height; // 非全景模式下隐藏所有标尺
357
+
358
+ if (currentMode !== _five.Five.Mode.Panorama) {
359
+ for (var _name2 in __rule) {
360
+ var _iterator2 = _createForOfIteratorHelper(__rule[_name2].rules),
361
+ _step2;
362
+
363
+ try {
364
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
365
+ var $element = _step2.value.$element;
366
+ $element.style.display = 'none';
367
+ }
368
+ } catch (err) {
369
+ _iterator2.e(err);
370
+ } finally {
371
+ _iterator2.f();
372
+ }
373
+ }
374
+
375
+ return;
376
+ } // 隐藏非当前点位的标尺
377
+
378
+
379
+ for (var _name3 in __rule) {
380
+ var _iterator3 = _createForOfIteratorHelper(__rule[_name3].rules),
381
+ _step3;
382
+
383
+ try {
384
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
385
+ var _$element2 = _step3.value.$element;
386
+ _$element2.style.display = _name3 === name ? 'block' : 'none';
387
+ }
388
+ } catch (err) {
389
+ _iterator3.e(err);
390
+ } finally {
391
+ _iterator3.f();
392
+ }
393
+ }
394
+
395
+ var verticalLines = []; // 可以看到的角度最小的拐点
396
+
397
+ var _rule$name$origins$s = __rule[name].origins.slice().filter(function (point) {
398
+ return point.observers.indexOf(panoIndex) >= 0;
399
+ }).sort(function (pointA, pointB) {
400
+ var angleA = pointA.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
401
+ var angleB = pointB.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
402
+ return angleA - angleB;
403
+ }),
404
+ _rule$name$origins$s2 = _slicedToArray(_rule$name$origins$s, 1),
405
+ visibleOrigin = _rule$name$origins$s2[0];
406
+
407
+ var shownNotVerticalRules = [];
408
+
409
+ var _iterator4 = _createForOfIteratorHelper(__rule[name].rules),
410
+ _step4;
411
+
412
+ try {
413
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
414
+ var _step4$value = _step4.value,
415
+ rule = _step4$value.rule,
416
+ vertical = _step4$value.vertical,
417
+ _$element3 = _step4$value.$element;
418
+
419
+ var _rule = _slicedToArray(rule, 2),
420
+ start = _rule[0],
421
+ end = _rule[1];
422
+
423
+ var $line = _$element3.querySelector('.PanoRulerPlugin-rule-line');
424
+
425
+ if (!$line) return;
426
+
427
+ if (!visibleOrigin) {
428
+ _$element3.style.display = 'none';
429
+ continue;
430
+ }
431
+
432
+ if (start !== visibleOrigin && end !== visibleOrigin) {
433
+ _$element3.style.display = 'none';
434
+ continue;
435
+ }
436
+
437
+ if (start.distanceTo(end) < 0.5) {
438
+ _$element3.style.display = 'none';
439
+ continue;
440
+ }
441
+
442
+ if (start.observers.indexOf(panoIndex) === -1 || end.observers.indexOf(panoIndex) === -1) {
443
+ _$element3.style.display = 'none';
444
+ continue;
445
+ }
446
+
447
+ var startAngle = start.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
448
+
449
+ if (startAngle > Math.PI / 2) {
450
+ _$element3.style.display = 'none';
451
+ continue;
452
+ }
453
+
454
+ var endAngle = end.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
455
+
456
+ if (endAngle > Math.PI / 2) {
457
+ _$element3.style.display = 'none';
458
+ continue;
459
+ }
460
+
461
+ var ruleLength = start.distanceTo(end);
462
+ var midPoint = end.clone().sub(end.clone().sub(start).divide(new _three.Vector3(2, 2, 2)));
463
+ var disFromCameraToMid = midPoint.distanceTo(cameraPosition);
464
+
465
+ if (disFromCameraToMid / ruleLength > 8) {
466
+ _$element3.style.display = 'none';
467
+ continue;
468
+ }
469
+
470
+ if (!vertical) shownNotVerticalRules.push(rule);
471
+ if (vertical) verticalLines.push({
472
+ $element: _$element3,
473
+ startAngle: startAngle
474
+ });
475
+ var mouseStart = start.clone().project(camera);
476
+ var startLeft = (mouseStart.x + 1) / 2 * width;
477
+ var startTop = (-mouseStart.y + 1) / 2 * height;
478
+ var mouseEnd = end.clone().project(camera);
479
+ var endLeft = (mouseEnd.x + 1) / 2 * width;
480
+ var endTop = (-mouseEnd.y + 1) / 2 * height;
481
+
482
+ var _distance = Math.sqrt(Math.pow(endLeft - startLeft, 2) + Math.pow(endTop - startTop, 2));
483
+
484
+ var visibleLength = _distance;
485
+ var labelOffset = 50;
486
+ var intr = getRuleScreenIntr({
487
+ x: ~~startLeft,
488
+ y: ~~startTop
489
+ }, {
490
+ x: ~~endLeft,
491
+ y: ~~endTop
492
+ }, width, height);
493
+
494
+ if (intr && intr.length === 1) {
495
+ if (visibleOrigin === start) {
496
+ visibleLength = Math.sqrt(Math.pow(intr[0].x - startLeft, 2) + Math.pow(intr[0].y - startTop, 2));
497
+ labelOffset = visibleLength / _distance * 50;
498
+ } else if (visibleOrigin === end) {
499
+ visibleLength = Math.sqrt(Math.pow(intr[0].x - endLeft, 2) + Math.pow(intr[0].y - endTop, 2));
500
+ labelOffset = 100 - visibleLength / _distance * 50;
501
+ }
502
+ }
503
+
504
+ if (intr && intr.length === 2) {
505
+ var middlePoint = {
506
+ x: (intr[0].x + intr[1].x) / 2,
507
+ y: (intr[0].y + intr[1].y) / 2
508
+ };
509
+ var distanceFromStart = Math.sqrt(Math.pow(middlePoint.x - startLeft, 2) + Math.pow(middlePoint.y - startTop, 2));
510
+ labelOffset = distanceFromStart / _distance * 100;
511
+ }
512
+
513
+ var rad = Math.PI / 2 - Math.atan2(endLeft - startLeft, startTop - endTop);
514
+ var deg = rad / Math.PI * 180;
515
+ $line.style.width = _distance + 'px';
516
+ $line.style.left = startLeft + 'px';
517
+ $line.style.top = startTop + 'px';
518
+ $line.style.transform = "rotate(".concat(-deg, "deg)");
519
+ var $label = $line.querySelector('.PanoRulerPlugin-rule-label');
520
+ var reverse = endLeft - startLeft > 0;
521
+ var rotateY = reverse ? ' rotateY(180deg)' : '';
522
+ $label.style.transform = "rotate(".concat(deg, "deg)") + rotateY;
523
+ $label.style.left = "".concat(labelOffset, "%");
524
+
525
+ if (reverse) {
526
+ $label.setAttribute('class', 'PanoRulerPlugin-rule-label reverse');
527
+ } else {
528
+ $label.setAttribute('class', 'PanoRulerPlugin-rule-label');
529
+ }
530
+ }
531
+ } catch (err) {
532
+ _iterator4.e(err);
533
+ } finally {
534
+ _iterator4.f();
535
+ }
536
+ };
537
+
538
+ var nextFrameFreshRule = function nextFrameFreshRule() {
539
+ return (0, _nextFrame.nextFrame)(freshRule);
540
+ };
541
+
542
+ var throttleFreshRule = (0, _throttle["default"])(freshRule, 80);
543
+
544
+ var enable = function enable() {
545
+ var _five$getElement, _five$getElement$pare;
546
+
547
+ if (!state.loaded) return false;
548
+ if (state.enable) return true;
549
+ $rule.setAttribute('class', 'PanoRulerPlugin' + (state.options.className ? ' ' + state.options.className : ''));
550
+ (_five$getElement = five.getElement()) === null || _five$getElement === void 0 ? void 0 : (_five$getElement$pare = _five$getElement.parentElement) === null || _five$getElement$pare === void 0 ? void 0 : _five$getElement$pare.append($rule);
551
+ freshRule();
552
+ five.on('panoArrived', freshRule);
553
+ five.on('modeChange', freshRule);
554
+ five.on('cameraDirectionUpdate', nextFrameFreshRule);
555
+ five.on('movingToPano', nextFrameFreshRule);
556
+ five.on('mouseWheel', throttleFreshRule);
557
+ five.on('pinchGesture', throttleFreshRule);
558
+ state.enable = true;
559
+ return true;
560
+ };
561
+
562
+ var disable = function disable() {
563
+ if (!state.enable) return true;
564
+ five.off('panoArrived', freshRule);
565
+ five.off('modeChange', freshRule);
566
+ five.off('cameraDirectionUpdate', nextFrameFreshRule);
567
+ five.off('movingToPano', nextFrameFreshRule);
568
+ five.off('mouseWheel', throttleFreshRule);
569
+ five.off('pinchGesture', throttleFreshRule);
570
+
571
+ if ($rule) {
572
+ $rule.remove();
573
+ }
574
+
575
+ state.enable = false;
576
+ return true;
577
+ };
578
+
579
+ return {
580
+ enable: enable,
581
+ disable: disable,
582
+ load: load,
583
+ state: state
584
+ };
585
+ };
586
+
587
+ exports.PanoRulerPlugin = PanoRulerPlugin;
588
+ var _default = PanoRulerPlugin;
589
+ exports["default"] = _default;
@@ -0,0 +1,21 @@
1
+ export interface Room {
2
+ id: string;
3
+ name: string;
4
+ localName: string;
5
+ area: number;
6
+ }
7
+ export interface Rooms {
8
+ [key: string]: Room;
9
+ }
10
+ export declare type RoomObservers = string[];
11
+ export interface RoomInfo {
12
+ rooms: Rooms;
13
+ observers: RoomObservers;
14
+ }
15
+ export interface RoomRules {
16
+ [key: string]: {
17
+ x: number;
18
+ z: number;
19
+ observers: number[];
20
+ }[];
21
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,24 @@
1
+ import { FivePlugin } from '@realsee/five';
2
+ export declare type PanoTVVideoPluginPoints = Record<string, {
3
+ position: {
4
+ y: number;
5
+ x: number;
6
+ z: number;
7
+ };
8
+ name: 'p0' | 'p1' | 'p2' | 'p3';
9
+ }[][]>;
10
+ export interface PanoTVVideoPluginData {
11
+ video_src: string;
12
+ video_poster_src: string;
13
+ points: PanoTVVideoPluginPoints;
14
+ }
15
+ export interface PanoTVVideoPluginParameterType {
16
+ videoElement?: HTMLVideoElement;
17
+ }
18
+ export interface PanoTVVideoPluginExportType {
19
+ enable: () => void;
20
+ disable: () => void;
21
+ load: (data: PanoTVVideoPluginData, videoElement?: HTMLVideoElement) => void;
22
+ }
23
+ export declare const PanoTVVideoPlugin: FivePlugin<PanoTVVideoPluginParameterType, PanoTVVideoPluginExportType>;
24
+ export default PanoTVVideoPlugin;