@realsee/dnalogel 0.1.3 → 0.1.7-alpha.10
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/components/ARVideoFigure/ARVideoFigureMesh.js +56 -32
- package/components/ARVideoFigure/ARVideoFigureScene.js +30 -19
- package/components/ARVideoFigure/ImgBgTransparent.js +22 -6
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +40 -30
- package/components/ARVideoFigure/fragmentShader.js +2 -0
- package/components/ARVideoFigure/index.js +22 -6
- package/components/ARVideoFigure/vertexShader.js +2 -0
- package/components/GLTFView/index.d.ts +123 -0
- package/components/GLTFView/index.js +204 -0
- package/components/GlassFilters/index.js +25 -1
- package/components/ModelView/ModelViewController.js +39 -29
- package/components/ModelView/index.js +4 -2
- package/components/PaintBrush/index.js +15 -1
- package/components/PanoTag/index.js +2 -0
- package/data/1aGKl9JmrlXMXx8d.js +2 -0
- package/data/54djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/54djM0oR6ky3Ey8e.js +350 -0
- package/data/6gyq3v1verxD7JO1.js +2 -0
- package/data/8054djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/8054djM0oR6ky3Ey8e.js +350 -0
- package/data/81zxMaeVKLQU93OZMG.d.ts +49 -0
- package/data/81zxMaeVKLQU93OZMG.js +633 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +2 -0
- package/data/PrXel3aqGbp34JQn.js +141 -1
- package/data/XJ6NMLWnkAY3Rdx8.js +2 -0
- package/data/YdoNP9K4rwQDwjJr.js +2 -0
- package/data/ZLvK29zj4L29Jowd.d.ts +55 -0
- package/data/ZLvK29zj4L29Jowd.js +372 -0
- package/data/_vLykj3NWrllMrG06.d.ts +95 -0
- package/data/_vLykj3NWrllMrG06.js +1 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +2 -0
- package/data/extrude-walls/ZLvK29zj4L29Jowd.d.ts +5 -0
- package/data/extrude-walls/ZLvK29zj4L29Jowd.js +14 -0
- package/data/extrude-walls/lo024DEgzanMj5BE.d.ts +5 -0
- package/data/extrude-walls/lo024DEgzanMj5BE.js +14 -0
- package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.js +2 -0
- package/data/lo024DEgzanMj5BE.d.ts +55 -0
- package/data/lo024DEgzanMj5BE.js +966 -0
- package/data/oPzy3ApbjjpD8YdR.js +2 -0
- package/data/qjAxMG4XbPn96wKG.js +2 -0
- package/data/rXel3aPQRRBD4JQn.js +2 -0
- package/data/vLykj3NWrllMrG06.js +337 -71
- package/data/wz0QV9KA4ugyo9ME.js +2 -0
- package/data/zxMawr9raSg8LYjG.js +2 -0
- package/examples/FiveStateController/index.js +9 -15
- package/examples/VRHouse/Mobile.js +15 -1
- package/examples/VRHouse/PC.js +15 -1
- package/examples/VRHouse/index.js +15 -1
- package/index.js +4 -2
- package/libs/gltf-viewer/Subscribe.d.ts +76 -0
- package/libs/gltf-viewer/Subscribe.js +231 -0
- package/libs/gltf-viewer/coordsMoveByOffset.d.ts +13 -0
- package/libs/gltf-viewer/coordsMoveByOffset.js +22 -0
- package/libs/gltf-viewer/coordsToDirection.d.ts +5 -0
- package/{components/PBRView/index.js → libs/gltf-viewer/coordsToDirection.js} +29 -19
- package/libs/gltf-viewer/formatRad.d.ts +1 -0
- package/libs/gltf-viewer/formatRad.js +13 -0
- package/libs/gltf-viewer/getFrameTime.d.ts +1 -0
- package/libs/gltf-viewer/getFrameTime.js +28 -0
- package/libs/gltf-viewer/index.d.ts +79 -0
- package/libs/gltf-viewer/index.js +765 -0
- package/libs/gltf-viewer/mouseWheel.d.ts +2 -0
- package/libs/gltf-viewer/mouseWheel.js +59 -0
- package/libs/gltf-viewer/requestAnimationFrame.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrame.js +18 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.js +31 -0
- package/libs/gltf-viewer/uuid.d.ts +4 -0
- package/libs/gltf-viewer/uuid.js +28 -0
- package/package.json +8 -4
- package/plugins/AutoPreloadPlugin/index.js +26 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +24 -16
- package/plugins/CSS3DRenderPlugin/index.js +45 -12
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.d.ts +7 -0
- package/plugins/CSS3DRenderPlugin/utils/createResizeObserver.js +34 -0
- package/plugins/CameraMovementPlugin/index.js +33 -9
- package/plugins/CameraMovementPlugin/typing.js +2 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +1 -1
- package/plugins/ModelChassisCompassPlugin/index.js +25 -10
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +6 -2
- package/plugins/ModelEntryDoorGuidePlugin/index.js +55 -28
- package/plugins/ModelExtrudeWallsPlugin/index.d.ts +16 -0
- package/plugins/ModelExtrudeWallsPlugin/index.js +252 -0
- package/plugins/ModelRoomLabelPlugin/Controller.js +30 -23
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +26 -8
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +35 -25
- package/plugins/ModelRoomLabelPlugin/index.d.ts +4 -0
- package/plugins/ModelRoomLabelPlugin/index.js +9 -2
- package/plugins/ModelRoomLabelPlugin/typings.js +2 -0
- package/plugins/ModelRoomLabelPlugin/utils/parseData.js +6 -0
- package/plugins/ModelTVVideoPlugin/index.js +100 -16
- package/plugins/ModelViewPlugin/index.js +25 -1
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +29 -25
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +15 -1
- package/plugins/PanoCursorRaycasterPlugin/index.js +13 -6
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +4 -2
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +15 -1
- package/plugins/PanoDoorLabelPlugin/index.js +2 -0
- package/plugins/PanoIRobotPlugin/index.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/compare.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.js +22 -1
- package/plugins/PanoMaskSelectorPlugin/createTextures.js +17 -1
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/index.js +106 -18
- package/plugins/PanoMaskSelectorPlugin/vertexShader.js +2 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/plugins/PanoMeasurePlugin/Controller/BaseController.js +103 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/plugins/PanoMeasurePlugin/Controller/EditController.js +341 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Controller/ShortcutKeyController.js +69 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
- package/plugins/PanoMeasurePlugin/Controller/WatchController.js +371 -0
- package/plugins/PanoMeasurePlugin/Controller/index.d.ts +61 -0
- package/plugins/PanoMeasurePlugin/Controller/index.js +230 -0
- package/plugins/PanoMeasurePlugin/Model/index.d.ts +38 -0
- package/plugins/PanoMeasurePlugin/Model/index.js +235 -0
- package/plugins/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/plugins/PanoMeasurePlugin/Model/line.js +121 -0
- package/plugins/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/point.js +68 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Model/polyline.js +109 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +11 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
- package/plugins/PanoMeasurePlugin/Modules/DeleteDom/index.js +182 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/plugins/PanoMeasurePlugin/Modules/FiveHelper.js +66 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/GuideController.js +107 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
- package/plugins/PanoMeasurePlugin/Modules/Magnifier.js +139 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/HTML.js +26 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +169 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +59 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/index.js +123 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/Modules/UIController/style.js +103 -0
- package/plugins/PanoMeasurePlugin/index.d.ts +7 -0
- package/plugins/PanoMeasurePlugin/index.js +20 -0
- package/plugins/PanoMeasurePlugin/typings/data.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/data.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/typings/event.type.js +7 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/typings/utils.type.js +7 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/clearGroup.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/constants.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/constants.js +47 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
- package/plugins/PanoMeasurePlugin/utils/distanceDom.js +147 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/findAssociatedLines.js +37 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/findClosestPoint.js +49 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
- package/plugins/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +20 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
- package/plugins/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +33 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
- package/plugins/PanoMeasurePlugin/utils/ironbox.js +14 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/isNDCPointInScreen.js +16 -0
- package/plugins/PanoMeasurePlugin/utils/line.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/line.js +61 -0
- package/plugins/PanoMeasurePlugin/utils/math.d.ts +17 -0
- package/plugins/PanoMeasurePlugin/utils/math.js +57 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
- package/plugins/PanoMeasurePlugin/utils/mouseGroup.js +42 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
- package/plugins/PanoMeasurePlugin/utils/ndc2Screen.js +16 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.js +2 -0
- package/plugins/PanoRulerPlugin/data/roomRules.js +2 -0
- package/plugins/PanoRulerPlugin/index.d.ts +4 -0
- package/plugins/PanoRulerPlugin/index.js +74 -21
- package/plugins/PanoRulerPlugin/typings.js +2 -0
- package/plugins/PanoTVVideoPlugin/index.d.ts +2 -0
- package/plugins/PanoTVVideoPlugin/index.js +108 -26
- package/plugins/TreasurePlugin/Controller.js +58 -52
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +36 -21
- package/plugins/TreasurePlugin/TreasureObject.js +60 -56
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +38 -19
- package/plugins/TreasurePlugin/constants.js +2 -0
- package/plugins/TreasurePlugin/index.js +2 -0
- package/plugins/TreasurePlugin/typings.js +2 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -1
- package/plugins/floorplan/Assets/floorplanExtraObject.js +5 -3
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +5 -2
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +93 -99
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +25 -7
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +22 -8
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +28 -4
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +25 -5
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.d.ts +11 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomMaterial.js +174 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.d.ts +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RuleLabels.js +178 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +32 -6
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +3 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +30 -8
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.js +4 -2
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.d.ts +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/utility.js +7 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +1 -1
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +3 -1
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +14 -22
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +26 -3
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +10 -6
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +21 -5
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +28 -4
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +22 -6
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +29 -19
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +2 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +1 -1
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +47 -50
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +4 -2
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +3 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +66 -61
- package/plugins/floorplan/TopviewFloorplanPlugin/index.js +2 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.js +2 -0
- package/plugins/floorplan/components/FloorplanImage.js +15 -1
- package/plugins/floorplan/index.d.ts +4 -0
- package/plugins/floorplan/index.js +13 -0
- package/plugins/floorplan/typings/floorplanData.d.ts +2 -0
- package/plugins/floorplan/typings/floorplanData.js +2 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +3 -1
- package/plugins/floorplan/typings/floorplanServerData.js +5 -3
- package/plugins/floorplan/utils/formatData.js +31 -12
- package/plugins/floorplan/utils/formatPosition.js +10 -8
- package/shared-utils/Preloader.js +6 -0
- package/shared-utils/Subscribe.js +36 -16
- package/shared-utils/animationFrame/BetterTween.js +28 -27
- package/shared-utils/animationFrame/calculateProgress.js +2 -0
- package/shared-utils/animationFrame/formatRad.js +2 -0
- package/shared-utils/animationFrame/index.js +12 -0
- package/shared-utils/animationFrame/tween.js +17 -1
- package/shared-utils/changeModelCanvasOpacity.d.ts +2 -0
- package/shared-utils/{changeModelCanvansOpacity.js → changeModelCanvasOpacity.js} +16 -2
- package/shared-utils/createCanvasTextTexture.js +2 -0
- package/shared-utils/createFiveContainer.js +23 -17
- package/shared-utils/createLine/index.js +15 -1
- package/shared-utils/debounce.js +4 -0
- package/shared-utils/equal.js +15 -4
- package/shared-utils/filter.js +36 -2
- package/shared-utils/five/changeMode.js +13 -17
- package/shared-utils/five/useFivePlugin.js +2 -0
- package/shared-utils/formatRad.js +2 -0
- package/shared-utils/getPxmm.js +15 -1
- package/shared-utils/getRandomColor.js +10 -0
- package/shared-utils/isNil.js +2 -0
- package/shared-utils/isTruelyObject.js +4 -0
- package/shared-utils/math/evenNumber.d.ts +3 -1
- package/shared-utils/math/evenNumber.js +6 -2
- package/shared-utils/math/planimetry.js +10 -0
- package/shared-utils/math/rad2Deg.js +2 -0
- package/shared-utils/nearlyEqual.js +2 -0
- package/shared-utils/nextFrame.js +2 -0
- package/shared-utils/noop.js +2 -0
- package/shared-utils/object3d2LocalMatrix.js +20 -14
- package/shared-utils/px2rem.js +10 -0
- package/shared-utils/removeArrayItem.d.ts +7 -0
- package/shared-utils/removeArrayItem.js +22 -0
- package/shared-utils/tap.js +2 -0
- package/shared-utils/three/centerPoint.js +2 -0
- package/shared-utils/three/getExtraModelLoader.js +14 -0
- package/shared-utils/three/getNormal.js +4 -0
- package/shared-utils/three/getTextureLoader.js +16 -0
- package/shared-utils/three/loadFbxObj.js +13 -5
- package/shared-utils/three/loadTexture.d.ts +2 -2
- package/shared-utils/three/loadTexture.js +33 -6
- package/shared-utils/three/transformPositionToVector3.js +2 -0
- package/shared-utils/three/transfromToMeshBasicMaterial.js +6 -0
- package/shared-utils/throttle.js +4 -0
- package/shared-utils/to.js +8 -4
- package/shared-utils/useDebounce.js +6 -0
- package/shared-utils/useThrottle.js +6 -0
- package/shared-utils/uuid.js +8 -0
- package/shared-utils/vectorTocoordinates.js +2 -0
- package/typedoc/components.js +2 -0
- package/typedoc/libs.d.ts +1 -0
- package/typedoc/libs.js +7 -0
- package/typedoc/plugins.js +2 -0
- package/typedoc/shared-utils.js +2 -0
- package/typedoc/typings.js +2 -0
- package/typings/math.type.js +2 -0
- package/typings/utils.type.js +2 -0
- package/components/PBRView/index.d.ts +0 -14
- package/shared-utils/changeModelCanvansOpacity.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type ValueOf<T> = T[keyof T];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = clearGroup;
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
function clearGroup(group) {
|
|
15
|
+
group.children.length > 0 && group.remove.apply(group, (0, _toConsumableArray2["default"])(group.children));
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.normalLineOpts = exports.lightLineOpts = exports.dashLineOpts = void 0;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.object.assign.js");
|
|
11
|
+
|
|
12
|
+
var _three = require("three");
|
|
13
|
+
|
|
14
|
+
var lineWidth = 2;
|
|
15
|
+
var lightLineWidth = 4;
|
|
16
|
+
var lineColor = new _three.Color(0xffffff);
|
|
17
|
+
var lightLineColor = new _three.Color(0x2d7cff);
|
|
18
|
+
var pointColor = new _three.Color(0xffffff);
|
|
19
|
+
var lightPointColor = new _three.Color(0x2d7cff);
|
|
20
|
+
var pointSize = 8;
|
|
21
|
+
var lightPointSize = 16;
|
|
22
|
+
var pointImage = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==';
|
|
23
|
+
var pointTexture = new _three.TextureLoader().load(pointImage);
|
|
24
|
+
var normalLineOpts = {
|
|
25
|
+
pointTexture: pointTexture,
|
|
26
|
+
pointSize: pointSize,
|
|
27
|
+
lineWidth: lineWidth,
|
|
28
|
+
lineColor: lineColor,
|
|
29
|
+
pointColor: pointColor,
|
|
30
|
+
lineRenderOrder: 20,
|
|
31
|
+
pointsRenderOrder: 20
|
|
32
|
+
};
|
|
33
|
+
exports.normalLineOpts = normalLineOpts;
|
|
34
|
+
var dashLineOpts = Object.assign({}, normalLineOpts, {
|
|
35
|
+
dashed: true
|
|
36
|
+
});
|
|
37
|
+
exports.dashLineOpts = dashLineOpts;
|
|
38
|
+
var lightLineOpts = {
|
|
39
|
+
pointTexture: pointTexture,
|
|
40
|
+
pointSize: lightPointSize,
|
|
41
|
+
lineWidth: lightLineWidth,
|
|
42
|
+
lineColor: lightLineColor,
|
|
43
|
+
pointColor: lightPointColor,
|
|
44
|
+
lineRenderOrder: 10,
|
|
45
|
+
pointsRenderOrder: 10
|
|
46
|
+
};
|
|
47
|
+
exports.lightLineOpts = lightLineOpts;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Line from '../Model/line';
|
|
2
|
+
import { Five } from '@realsee/five';
|
|
3
|
+
import { Vector3 } from 'three';
|
|
4
|
+
import { LineCompletelyJson, PolylineCompletelyJson } from '../typings/data';
|
|
5
|
+
export declare type DistanceItem = ReturnType<typeof creatDistanceItem>;
|
|
6
|
+
export interface UserDistanceItem {
|
|
7
|
+
element: Element;
|
|
8
|
+
highlight: () => void;
|
|
9
|
+
unHighlight: () => void;
|
|
10
|
+
update: (params: {
|
|
11
|
+
line: LineCompletelyJson;
|
|
12
|
+
polyline: PolylineCompletelyJson;
|
|
13
|
+
}) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface IDistanceItemProps {
|
|
16
|
+
line: Line;
|
|
17
|
+
userDistanceItem?: UserDistanceItem;
|
|
18
|
+
clickCallback?: (item: DistanceItem) => unknown;
|
|
19
|
+
}
|
|
20
|
+
export declare function creatDistanceItem(props: IDistanceItemProps): {
|
|
21
|
+
lineID: string;
|
|
22
|
+
ndcPosition: Vector3;
|
|
23
|
+
update: (five: Five) => void;
|
|
24
|
+
appendTo: (container: Element) => void;
|
|
25
|
+
remove: () => void;
|
|
26
|
+
highlight: () => void;
|
|
27
|
+
unHighlight: () => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.creatDistanceItem = creatDistanceItem;
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.concat.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.number.to-fixed.js");
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _three = require("three");
|
|
19
|
+
|
|
20
|
+
var _isNDCPointInScreen = _interopRequireDefault(require("./isNDCPointInScreen"));
|
|
21
|
+
|
|
22
|
+
function creatContentDom() {
|
|
23
|
+
var contentDom = document.createElement('div');
|
|
24
|
+
contentDom.style.height = '24px';
|
|
25
|
+
contentDom.style.width = '62px';
|
|
26
|
+
contentDom.style.lineHeight = '24px';
|
|
27
|
+
contentDom.style.textAlign = 'center';
|
|
28
|
+
contentDom.style.transform = 'translate(-50%, -50%)';
|
|
29
|
+
contentDom.style.borderRadius = '12px';
|
|
30
|
+
contentDom.style.fontSize = '14px';
|
|
31
|
+
contentDom.style.color = '#000000';
|
|
32
|
+
contentDom.style.background = '#fff';
|
|
33
|
+
contentDom.style.pointerEvents = 'all';
|
|
34
|
+
contentDom.style.cursor = 'pointer';
|
|
35
|
+
return contentDom;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function createContainerDom(line) {
|
|
39
|
+
var containerDom = document.createElement('div');
|
|
40
|
+
containerDom.id = 'distance_' + line.id;
|
|
41
|
+
containerDom.classList.add('five-plugin-measure__distance');
|
|
42
|
+
containerDom.style.opacity = '0';
|
|
43
|
+
containerDom.style.position = 'absolute';
|
|
44
|
+
containerDom.style.left = '0';
|
|
45
|
+
containerDom.style.top = '0';
|
|
46
|
+
containerDom.style.transform = 'translate3d(0, 0, 0)';
|
|
47
|
+
return containerDom;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function creatDistanceItem(props) {
|
|
51
|
+
function handleClick() {
|
|
52
|
+
var _props$clickCallback;
|
|
53
|
+
|
|
54
|
+
highlight();
|
|
55
|
+
(_props$clickCallback = props.clickCallback) === null || _props$clickCallback === void 0 ? void 0 : _props$clickCallback.call(props, distanceItem);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function highlight() {
|
|
59
|
+
if (userDistanceItem) return userDistanceItem.highlight();
|
|
60
|
+
contentDom.style.border = '1px solid #538FFF';
|
|
61
|
+
contentDom.style.color = '#538FFF';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function unHighlight() {
|
|
65
|
+
if (userDistanceItem) return userDistanceItem.unHighlight();
|
|
66
|
+
contentDom.style.border = 'none';
|
|
67
|
+
contentDom.style.color = '#000';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function update(five) {
|
|
71
|
+
var fiveElement = five.getElement();
|
|
72
|
+
if (!fiveElement) return;
|
|
73
|
+
var screenWidth = fiveElement.clientWidth;
|
|
74
|
+
var screenHeight = fiveElement.clientHeight;
|
|
75
|
+
if (line.points.length < 2) return;
|
|
76
|
+
|
|
77
|
+
var _line$points = (0, _slicedToArray2["default"])(line.points, 2),
|
|
78
|
+
startPoint = _line$points[0],
|
|
79
|
+
endPoint = _line$points[1];
|
|
80
|
+
|
|
81
|
+
var ndcStartPosition = startPoint.position.clone().project(five.camera);
|
|
82
|
+
var ndcEndPosition = endPoint.position.clone().project(five.camera);
|
|
83
|
+
var ndcDomPosition = ndcStartPosition.clone().lerp(ndcEndPosition, 0.5);
|
|
84
|
+
|
|
85
|
+
var visible = function () {
|
|
86
|
+
// 对于超过近平面和远平面的点,计算会有问题
|
|
87
|
+
if (Math.abs(ndcStartPosition.z) > 1 || Math.abs(ndcEndPosition.z) > 1) return false;
|
|
88
|
+
if (!(0, _isNDCPointInScreen["default"])(ndcStartPosition) && !(0, _isNDCPointInScreen["default"])(ndcEndPosition)) return false;
|
|
89
|
+
if (!(0, _isNDCPointInScreen["default"])(ndcDomPosition)) return false;
|
|
90
|
+
var screenStartPosition = new _three.Vector2(ndcStartPosition.x * screenWidth, ndcStartPosition.y * screenHeight);
|
|
91
|
+
var screenEndPosition = new _three.Vector2(ndcEndPosition.x * screenWidth, ndcEndPosition.y * screenHeight);
|
|
92
|
+
if (screenStartPosition.distanceTo(screenEndPosition) < 20) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}();
|
|
95
|
+
|
|
96
|
+
if (visible === false) {
|
|
97
|
+
containerDom.style.opacity = '0';
|
|
98
|
+
containerDom.style.pointerEvents = 'none';
|
|
99
|
+
return;
|
|
100
|
+
} // 更新 UI
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
var left = (ndcDomPosition.x + 1) / 2 * screenWidth;
|
|
104
|
+
var top = -(ndcDomPosition.y - 1) / 2 * screenHeight;
|
|
105
|
+
containerDom.style.transform = "translate3d(".concat(left, "px, ").concat(top, "px, 10px)");
|
|
106
|
+
containerDom.style.opacity = '1';
|
|
107
|
+
containerDom.style.pointerEvents = 'all';
|
|
108
|
+
|
|
109
|
+
if (userDistanceItem) {
|
|
110
|
+
userDistanceItem.update({
|
|
111
|
+
line: line.toCompletelyJson(),
|
|
112
|
+
polyline: line.getPolyline().toCompletelyJson()
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var distanceString = startPoint.position.clone().distanceTo(endPoint.position).toFixed(2) + 'm';
|
|
117
|
+
contentDom.innerText !== distanceString && (contentDom.innerText = distanceString);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function appendTo(container) {
|
|
121
|
+
container.appendChild(containerDom);
|
|
122
|
+
containerDom.addEventListener('click', handleClick);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function remove() {
|
|
126
|
+
contentDom.removeEventListener('click', handleClick);
|
|
127
|
+
containerDom.remove();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
var line = props.line;
|
|
131
|
+
var lineID = line.id;
|
|
132
|
+
var contentDom = creatContentDom();
|
|
133
|
+
var containerDom = createContainerDom(line);
|
|
134
|
+
var userDistanceItem = props.userDistanceItem;
|
|
135
|
+
var ndcPosition = new _three.Vector3(0, 0, 0);
|
|
136
|
+
var distanceItem = {
|
|
137
|
+
lineID: lineID,
|
|
138
|
+
ndcPosition: ndcPosition,
|
|
139
|
+
update: update,
|
|
140
|
+
appendTo: appendTo,
|
|
141
|
+
remove: remove,
|
|
142
|
+
highlight: highlight,
|
|
143
|
+
unHighlight: unHighlight
|
|
144
|
+
};
|
|
145
|
+
userDistanceItem !== null && userDistanceItem !== void 0 && userDistanceItem.element ? containerDom.appendChild(userDistanceItem.element) : containerDom.appendChild(contentDom);
|
|
146
|
+
return distanceItem;
|
|
147
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.findAssociatedLines = findAssociatedLines;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.array.find.js");
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.find-index.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.array.concat.js");
|
|
15
|
+
|
|
16
|
+
function findAssociatedLines(line) {
|
|
17
|
+
// 找跟这个线段相邻的线
|
|
18
|
+
var mergeNextLine = function mergeNextLine(point, nextIndex, target) {
|
|
19
|
+
var nextLine = point.lines.find(function (line) {
|
|
20
|
+
var pointIndex = line.points.findIndex(function (_ref) {
|
|
21
|
+
var id = _ref.id;
|
|
22
|
+
return id === point.id;
|
|
23
|
+
});
|
|
24
|
+
if (pointIndex === nextIndex) return false;
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
if (!nextLine) return target;
|
|
28
|
+
var nextPoint = nextLine.points[nextIndex];
|
|
29
|
+
if (!nextPoint) return target;
|
|
30
|
+
return mergeNextLine(nextPoint, nextIndex, target.concat(nextLine));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var rightLines = mergeNextLine(line.points[0], 1, []);
|
|
34
|
+
var leftLines = mergeNextLine(line.points[0], 0, []);
|
|
35
|
+
var lines = rightLines.concat(leftLines);
|
|
36
|
+
return lines;
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Vector2 } from 'three';
|
|
2
|
+
import Point from '../Model/point';
|
|
3
|
+
import { Five } from '@realsee/five';
|
|
4
|
+
/**
|
|
5
|
+
* @param tapPoint 注意这里的坐标是相对于 FiveElement 的
|
|
6
|
+
*/
|
|
7
|
+
export declare function findClosestPoint(five: Five, points: Point[], tapPoint: Vector2, maxDistance?: number): {
|
|
8
|
+
distance: number;
|
|
9
|
+
point: Point;
|
|
10
|
+
} | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.findClosestPoint = findClosestPoint;
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.sort.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.array.map.js");
|
|
15
|
+
|
|
16
|
+
var _ndc2Screen = _interopRequireDefault(require("./ndc2Screen"));
|
|
17
|
+
|
|
18
|
+
var _isNDCPointInScreen = _interopRequireDefault(require("./isNDCPointInScreen"));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param tapPoint 注意这里的坐标是相对于 FiveElement 的
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line max-params
|
|
24
|
+
function findClosestPoint(five, points, tapPoint, maxDistance) {
|
|
25
|
+
var container = five.getElement();
|
|
26
|
+
if (!container) return null;
|
|
27
|
+
if (points.length === 0) return null;
|
|
28
|
+
var containerSize = {
|
|
29
|
+
width: container.clientWidth,
|
|
30
|
+
height: container.clientHeight
|
|
31
|
+
};
|
|
32
|
+
var ndcPoints = points.map(function (point) {
|
|
33
|
+
var ndcPosition = point.position.clone().project(five.camera);
|
|
34
|
+
if (!(0, _isNDCPointInScreen["default"])(ndcPosition)) return {
|
|
35
|
+
distance: Infinity,
|
|
36
|
+
point: point
|
|
37
|
+
};
|
|
38
|
+
var screenPosition = (0, _ndc2Screen["default"])(ndcPosition, containerSize);
|
|
39
|
+
var distance = screenPosition.distanceTo(tapPoint);
|
|
40
|
+
return {
|
|
41
|
+
distance: distance,
|
|
42
|
+
point: point
|
|
43
|
+
};
|
|
44
|
+
}).sort(function (a, b) {
|
|
45
|
+
return a.distance - b.distance;
|
|
46
|
+
});
|
|
47
|
+
if (typeof maxDistance === 'number' && ndcPoints[0].distance > maxDistance) return null;
|
|
48
|
+
return ndcPoints[0];
|
|
49
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getIntersectionFromEvent = getIntersectionFromEvent;
|
|
9
|
+
|
|
10
|
+
var _three = require("three");
|
|
11
|
+
|
|
12
|
+
var _getPointFromHammerEvent = require("./getPointFromHammerEvent");
|
|
13
|
+
|
|
14
|
+
/** 通过鼠标事件或者触摸事件,获取当前点击屏幕关联的射线与模型的交点 */
|
|
15
|
+
function getIntersectionFromEvent(five, event) {
|
|
16
|
+
var mouse = (0, _getPointFromHammerEvent.getPointFromHammerEvent)(event).ndcPoint;
|
|
17
|
+
var raycaster = new _three.Raycaster();
|
|
18
|
+
raycaster.setFromCamera(mouse, five.camera);
|
|
19
|
+
return five.model.intersectRaycaster(raycaster);
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Hammer from 'hammerjs';
|
|
2
|
+
import { Vector2 } from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* 从 Hammer 事件中获取操作的点在交互 DOM 中的位置
|
|
5
|
+
* @ignore TODO: make a suitable name
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPointFromHammerEvent(event: typeof Hammer['Input']): {
|
|
8
|
+
point: Vector2;
|
|
9
|
+
ndcPoint: Vector2;
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getPointFromHammerEvent = getPointFromHammerEvent;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.string.sub.js");
|
|
11
|
+
|
|
12
|
+
var _three = require("three");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 从 Hammer 事件中获取操作的点在交互 DOM 中的位置
|
|
16
|
+
* @ignore TODO: make a suitable name
|
|
17
|
+
*/
|
|
18
|
+
function getPointFromHammerEvent(event) {
|
|
19
|
+
// clientX 与 clientY 是相对 document 的,需要转换成相对于 target 的坐标
|
|
20
|
+
var _event$center = event.center,
|
|
21
|
+
clientX = _event$center.x,
|
|
22
|
+
clientY = _event$center.y;
|
|
23
|
+
var _event$target = event.target,
|
|
24
|
+
clientWidth = _event$target.clientWidth,
|
|
25
|
+
clientHeight = _event$target.clientHeight;
|
|
26
|
+
var clientRect = event.target.getBoundingClientRect();
|
|
27
|
+
var position = new _three.Vector2(clientX, clientY).sub(new _three.Vector2(clientRect.left, clientRect.top));
|
|
28
|
+
var mouse = new _three.Vector2(position.x / clientWidth * 2 - 1, -(position.y / clientHeight) * 2 + 1);
|
|
29
|
+
return {
|
|
30
|
+
point: position,
|
|
31
|
+
ndcPoint: mouse
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const preventDefault: (e: Event) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.preventDefault = void 0;
|
|
9
|
+
|
|
10
|
+
var preventDefault = function preventDefault(e) {
|
|
11
|
+
return e.preventDefault();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.preventDefault = preventDefault;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = isNDCPointInScreen;
|
|
9
|
+
|
|
10
|
+
function isNDCPointInScreen(ndcPoint) {
|
|
11
|
+
var x = ndcPoint.x,
|
|
12
|
+
y = ndcPoint.y,
|
|
13
|
+
z = ndcPoint.z;
|
|
14
|
+
if (Math.abs(x) > 1 || Math.abs(y) > 1 || Math.abs(z) > 1) return false;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Line from '../Model/line';
|
|
2
|
+
import { Line as FiveLine } from '@realsee/five/line';
|
|
3
|
+
import { Color, Texture, Vector3 } from 'three';
|
|
4
|
+
declare type ISetMaterialOpts = Parameters<FiveLine['setMaterial']>[0];
|
|
5
|
+
export interface ICreatLineOpts extends ISetMaterialOpts {
|
|
6
|
+
hasPoint?: boolean;
|
|
7
|
+
pointSize?: number;
|
|
8
|
+
lineWidth?: number;
|
|
9
|
+
pointTexture?: Texture;
|
|
10
|
+
lineRenderOrder?: number;
|
|
11
|
+
pointsRenderOrder?: number;
|
|
12
|
+
lineColor?: Color | string | number;
|
|
13
|
+
pointColor?: Color | string | number;
|
|
14
|
+
}
|
|
15
|
+
export declare function creatLine(start: Vector3, end: Vector3, opts?: ICreatLineOpts): FiveLine;
|
|
16
|
+
export declare function creatLineMesh(line: Line, type: 'normal' | 'light'): FiveLine;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.creatLine = creatLine;
|
|
11
|
+
exports.creatLineMesh = creatLineMesh;
|
|
12
|
+
|
|
13
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.array.map.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.function.name.js");
|
|
18
|
+
|
|
19
|
+
var _line = require("@realsee/five/line");
|
|
20
|
+
|
|
21
|
+
var _constants = require("./constants");
|
|
22
|
+
|
|
23
|
+
var _three = require("three");
|
|
24
|
+
|
|
25
|
+
function creatLine(start, end, opts) {
|
|
26
|
+
var _opts$lineWidth, _opts$lineColor, _opts$pointSize, _opts$lineRenderOrder, _opts$lineRenderOrder2;
|
|
27
|
+
|
|
28
|
+
var lineWidth = (_opts$lineWidth = opts === null || opts === void 0 ? void 0 : opts.lineWidth) !== null && _opts$lineWidth !== void 0 ? _opts$lineWidth : 2;
|
|
29
|
+
var lineColor = (_opts$lineColor = opts === null || opts === void 0 ? void 0 : opts.lineColor) !== null && _opts$lineColor !== void 0 ? _opts$lineColor : new _three.Color(0xffffff);
|
|
30
|
+
var pointSize = (_opts$pointSize = opts === null || opts === void 0 ? void 0 : opts.pointSize) !== null && _opts$pointSize !== void 0 ? _opts$pointSize : 5;
|
|
31
|
+
var lineRenderOrder = (_opts$lineRenderOrder = opts === null || opts === void 0 ? void 0 : opts.lineRenderOrder) !== null && _opts$lineRenderOrder !== void 0 ? _opts$lineRenderOrder : 10;
|
|
32
|
+
var pointsRenderOrder = (_opts$lineRenderOrder2 = opts === null || opts === void 0 ? void 0 : opts.lineRenderOrder) !== null && _opts$lineRenderOrder2 !== void 0 ? _opts$lineRenderOrder2 : 20;
|
|
33
|
+
var line = new _line.Line(start, end); // set line
|
|
34
|
+
|
|
35
|
+
line.setMaterial({
|
|
36
|
+
linewidth: lineWidth,
|
|
37
|
+
color: lineColor
|
|
38
|
+
});
|
|
39
|
+
line.line.material.depthTest = false;
|
|
40
|
+
line.line.material.transparent = true;
|
|
41
|
+
line.line.renderOrder = lineRenderOrder; // set point
|
|
42
|
+
|
|
43
|
+
line.points.renderOrder = pointsRenderOrder;
|
|
44
|
+
var pointMaterial = line.points.material;
|
|
45
|
+
pointMaterial.depthTest = false;
|
|
46
|
+
pointMaterial.size = pointSize;
|
|
47
|
+
(opts === null || opts === void 0 ? void 0 : opts.pointColor) && pointMaterial.color.set(opts.pointColor).convertSRGBToLinear();
|
|
48
|
+
if (opts !== null && opts !== void 0 && opts.pointTexture) pointMaterial.map = opts.pointTexture;
|
|
49
|
+
return line;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function creatLineMesh(line, type) {
|
|
53
|
+
var _line$points = (0, _slicedToArray2["default"])(line.points, 2),
|
|
54
|
+
point = _line$points[0],
|
|
55
|
+
anotherPoint = _line$points[1];
|
|
56
|
+
|
|
57
|
+
var opts = type === 'light' ? _constants.lightLineOpts : _constants.normalLineOpts;
|
|
58
|
+
var fiveLine = creatLine(point.position, anotherPoint.position, opts);
|
|
59
|
+
fiveLine.name = 'normalLine_' + line.id;
|
|
60
|
+
return fiveLine;
|
|
61
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector2 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* 获取一点对于线段上最近的一点,
|
|
4
|
+
* 如果可以是过直线垂线的垂足,不行的话取线段的两端
|
|
5
|
+
* @param point
|
|
6
|
+
* @param linePoints
|
|
7
|
+
* @return
|
|
8
|
+
*/
|
|
9
|
+
export declare function closestPointOnLine(point: Vector2, linePoints: Vector2[]): Vector2;
|
|
10
|
+
/**
|
|
11
|
+
* 检查两个点是否位置相同
|
|
12
|
+
* point: { x: number, y: number }
|
|
13
|
+
* @param point1
|
|
14
|
+
* @param point2
|
|
15
|
+
* @return
|
|
16
|
+
*/
|
|
17
|
+
export declare function samePointAt(point1: Vector2, point2: Vector2): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.closestPointOnLine = closestPointOnLine;
|
|
9
|
+
exports.samePointAt = samePointAt;
|
|
10
|
+
|
|
11
|
+
var _three = require("three");
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 获取一点对于线段上最近的一点,
|
|
15
|
+
* 如果可以是过直线垂线的垂足,不行的话取线段的两端
|
|
16
|
+
* @param point
|
|
17
|
+
* @param linePoints
|
|
18
|
+
* @return
|
|
19
|
+
*/
|
|
20
|
+
function closestPointOnLine(point, linePoints) {
|
|
21
|
+
var tA = point.x - linePoints[0].x;
|
|
22
|
+
var tB = point.y - linePoints[0].y;
|
|
23
|
+
var tC = linePoints[1].x - linePoints[0].x;
|
|
24
|
+
var tD = linePoints[1].y - linePoints[0].y; // 设线段为 AB 线段,线段外一点为 P
|
|
25
|
+
// tDot = AP 向量与 AB 向量乘积,tLenSq 为 |AB|平方。
|
|
26
|
+
// tParam 是 AP 向量在 AB 向量投影向量 AC 与 AB 向量的比。
|
|
27
|
+
|
|
28
|
+
var tDot = tA * tC + tB * tD;
|
|
29
|
+
var tLenSq = tC * tC + tD * tD;
|
|
30
|
+
var tParam = tDot / tLenSq;
|
|
31
|
+
var tXx, tYy;
|
|
32
|
+
|
|
33
|
+
if (tParam < 0 || samePointAt(linePoints[0], linePoints[1])) {
|
|
34
|
+
tXx = linePoints[0].x;
|
|
35
|
+
tYy = linePoints[0].y;
|
|
36
|
+
} else if (tParam > 1) {
|
|
37
|
+
tXx = linePoints[1].x;
|
|
38
|
+
tYy = linePoints[1].y;
|
|
39
|
+
} else {
|
|
40
|
+
tXx = linePoints[0].x + tParam * tC;
|
|
41
|
+
tYy = linePoints[0].y + tParam * tD;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return new _three.Vector2(tXx, tYy);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 检查两个点是否位置相同
|
|
48
|
+
* point: { x: number, y: number }
|
|
49
|
+
* @param point1
|
|
50
|
+
* @param point2
|
|
51
|
+
* @return
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
function samePointAt(point1, point2) {
|
|
56
|
+
return point1.x === point2.x && point1.y === point2.y;
|
|
57
|
+
}
|