@realsee/dnalogel 2.0.0-alpha.30-beta → 2.0.0-alpha.30
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/CHANGELOG.md +7 -0
- package/dist/ItemLabelPlugin/index.js +362 -143
- package/dist/ItemLabelPlugin/typings.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/dist/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/dist/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/dist/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/dist/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/dist/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/dist/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/dist/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/dist/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/dist/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/dist/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/dist/PanoMeasurePlugin/index.d.ts +8 -5
- package/dist/PanoMeasurePlugin/index.js +1893 -3431
- package/dist/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/dist/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/dist/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/dist/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -3
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -3
- package/dist/index.es.js +1850 -3190
- package/dist/index.js +1784 -3122
- package/dist/index.umd.js +1787 -3126
- package/dist/shared-utils/index.d.ts +1 -0
- package/dist/shared-utils/math/Interval.d.ts +13 -0
- package/dist/shared-utils/math/Rectangle.d.ts +27 -0
- package/dist/shared-utils/math/index.d.ts +2 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +9 -0
- package/docs/classes/ModelRoomLabelController.html +5 -5
- package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +3 -3
- package/docs/interfaces/CameraMovementPluginExportType.html +3 -3
- package/docs/interfaces/FloorplanBounding.html +5 -5
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +8 -8
- package/docs/interfaces/FloorplanExtraObject.html +4 -4
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +7 -7
- package/docs/interfaces/FloorplanRoomLabelItem.html +4 -4
- package/docs/interfaces/FloorplanServerBounding.html +5 -5
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +8 -8
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +8 -8
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +4 -4
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +3 -3
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +3 -0
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -0
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +10 -10
- package/docs/modules.html +20 -20
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +211 -67
- package/libs/ItemLabelPlugin/ItemLabelItem.js +109 -54
- package/libs/ItemLabelPlugin/Plugin.js +7 -4
- package/libs/ItemLabelPlugin/typings.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.d.ts +1 -0
- package/libs/ItemLabelPlugin/utils/getLabelTransform.js +3 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.d.ts +5 -0
- package/libs/ItemLabelPlugin/utils/getStrokeLength.js +16 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.d.ts +6 -0
- package/libs/ItemLabelPlugin/utils/isImpacted.js +12 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
- package/libs/ItemLabelPlugin/utils/transform2RenderData.d.ts +3 -0
- package/libs/ItemLabelPlugin/utils/transform2RenderData.js +4 -0
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +5 -2
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +9 -1
- package/libs/PanoMeasurePlugin/Controller/EditController.js +4 -4
- package/libs/PanoMeasurePlugin/Controller/MixedController.d.ts +44 -0
- package/libs/PanoMeasurePlugin/Controller/MixedController.js +337 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +1 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +14 -3
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +17 -8
- package/libs/PanoMeasurePlugin/Controller/index.js +57 -18
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +11 -14
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +3 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +48 -11
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +49 -14
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +185 -60
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +1 -1
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/NewMainBtnController.js +98 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +24 -7
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/mobileHTML.js +80 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +10 -1
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.d.ts +4 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/html.js +64 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.d.ts +42 -0
- package/libs/PanoMeasurePlugin/Modules/rangePiece/index.js +265 -0
- package/libs/PanoMeasurePlugin/index.d.ts +8 -5
- package/libs/PanoMeasurePlugin/index.js +2 -0
- package/libs/PanoMeasurePlugin/typings/data.d.ts +4 -0
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +10 -1
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/calculateThreeMouse.js +15 -0
- package/libs/PanoMeasurePlugin/utils/constants.js +7 -7
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +19 -14
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -2
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +5 -6
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
- package/libs/shared-utils/index.d.ts +1 -0
- package/libs/shared-utils/index.js +1 -0
- package/libs/shared-utils/math/Interval.d.ts +13 -0
- package/libs/shared-utils/math/Interval.js +40 -0
- package/libs/shared-utils/math/Rectangle.d.ts +27 -0
- package/libs/shared-utils/math/Rectangle.js +50 -0
- package/libs/shared-utils/math/index.d.ts +2 -0
- package/libs/shared-utils/math/index.js +2 -0
- package/package.json +2 -1
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
const svg =
|
|
2
|
-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
fill-rule="nonzero"
|
|
13
|
-
/>
|
|
14
|
-
</svg>`;
|
|
1
|
+
const svg = `
|
|
2
|
+
<svg class="fpm__delete-icon" width="16px" height="17px" viewBox="0 0 16 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient x1="22.185491%" y1="100%" x2="66.8316686%" y2="6.67239121%" id="linearGradient-1">
|
|
5
|
+
<stop stop-color="#FFFCFC" stop-opacity="0.6" offset="0%"></stop>
|
|
6
|
+
<stop stop-color="#FFFFFF" offset="100%"></stop>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
<path fill="url(#linearGradient-1)" fill-rule="nonzero" transform="translate(2.16 2.16)" d="M11.2979686,2.71818182 C11.611378,2.71818182 11.8654465,2.97561809 11.8654465,3.29318182 C11.8654465,3.58428191 11.6519584,3.82485822 11.374972,3.86293275 L11.2979686,3.86818182 L10.464,3.868 L9.7236795,10.6246222 C9.64153248,11.3737453 9.04854423,11.9512142 8.32013277,12.0165596 L8.18206028,12.0227273 L3.68338622,12.0227273 C2.89302127,12.0227273 2.22904821,11.4205655 2.141767,10.6246222 L2.141767,10.6246222 L1.4,3.868 L0.567477876,3.86818182 C0.254068499,3.86818182 0,3.61074555 0,3.29318182 C0,3.00208173 0.213488114,2.76150541 0.49047449,2.72343089 L0.567477876,2.71818182 L11.2979686,2.71818182 Z M9.322,3.868 L2.542,3.868 L3.26978106,10.4976259 C3.28762252,10.6603274 3.39528004,10.7928487 3.53932022,10.8467307 L3.61412483,10.866894 L3.68338622,10.8727273 L8.18206028,10.8727273 C8.39410941,10.8727273 8.57224853,10.7111717 8.59566544,10.4976259 L8.59566544,10.4976259 L9.322,3.868 Z M8.16824216,0 C8.48165153,0 8.73572003,0.257436269 8.73572003,0.575 C8.73572003,0.866100087 8.52223192,1.1066764 8.24524554,1.14475093 L8.16824216,1.15 L3.69720434,1.15 C3.38379497,1.15 3.12972647,0.892563731 3.12972647,0.575 C3.12972647,0.283899913 3.34321458,0.0433235966 3.62020096,0.00524907226 L3.69720434,0 L8.16824216,0 Z"></path>
|
|
10
|
+
</svg>
|
|
11
|
+
`;
|
|
15
12
|
export default svg;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const image = "data:image/
|
|
1
|
+
declare const image = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTciIGhlaWdodD0iMjUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIxMC43MDYlIiB5MT0iNDIuNzQ0JSIgeDI9Ijg5LjA2NCUiIHkyPSI1Ny4yMDglIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9Ii4zMDgiIG9mZnNldD0iNDkuNTY5JSIvPjxzdG9wIHN0b3AtY29sb3I9IiNGRkYiIHN0b3Atb3BhY2l0eT0iMCIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iLS4yNSIgeT0iLS4yNSIgd2lkdGg9IjU3LjUiIGhlaWdodD0iMjMuNSIgcng9IjExLjI1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDEpIiBmaWxsPSIjMkMyQzJDIiBzdHJva2U9InVybCgjcHJlZml4X19hKSIgc3Ryb2tlLXdpZHRoPSIuNSIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9Ii4zMDMiLz48L3N2Zz4=";
|
|
2
2
|
export default image;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const image = `data:image/
|
|
1
|
+
const image = `data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTciIGhlaWdodD0iMjUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIxMC43MDYlIiB5MT0iNDIuNzQ0JSIgeDI9Ijg5LjA2NCUiIHkyPSI1Ny4yMDglIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9Ii4zMDgiIG9mZnNldD0iNDkuNTY5JSIvPjxzdG9wIHN0b3AtY29sb3I9IiNGRkYiIHN0b3Atb3BhY2l0eT0iMCIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iLS4yNSIgeT0iLS4yNSIgd2lkdGg9IjU3LjUiIGhlaWdodD0iMjMuNSIgcng9IjExLjI1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDEpIiBmaWxsPSIjMkMyQzJDIiBzdHJva2U9InVybCgjcHJlZml4X19hKSIgc3Ryb2tlLXdpZHRoPSIuNSIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9Ii4zMDMiLz48L3N2Zz4=`;
|
|
2
2
|
export default image;
|
|
@@ -6,10 +6,13 @@ export default class DeleteDom {
|
|
|
6
6
|
private lines;
|
|
7
7
|
private points;
|
|
8
8
|
private onClick;
|
|
9
|
+
private cancelDelete;
|
|
9
10
|
private content;
|
|
10
11
|
private container;
|
|
12
|
+
private masking;
|
|
11
13
|
constructor(five: Five, opts?: {
|
|
12
14
|
onClick?: (e: MouseEvent) => void;
|
|
15
|
+
cancelDelete?: (e: MouseEvent) => void;
|
|
13
16
|
});
|
|
14
17
|
dispose(): void;
|
|
15
18
|
appendTo(element: Element): this;
|
|
@@ -33,6 +33,12 @@ export default class DeleteDom {
|
|
|
33
33
|
writable: true,
|
|
34
34
|
value: void 0
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(this, "cancelDelete", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: void 0
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(this, "content", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
configurable: true,
|
|
@@ -45,6 +51,12 @@ export default class DeleteDom {
|
|
|
45
51
|
writable: true,
|
|
46
52
|
value: document.createElement('div')
|
|
47
53
|
});
|
|
54
|
+
Object.defineProperty(this, "masking", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: document.createElement('div')
|
|
59
|
+
});
|
|
48
60
|
Object.defineProperty(this, "onMouseEnter", {
|
|
49
61
|
enumerable: true,
|
|
50
62
|
configurable: true,
|
|
@@ -63,26 +75,29 @@ export default class DeleteDom {
|
|
|
63
75
|
});
|
|
64
76
|
this.five = five;
|
|
65
77
|
this.onClick = (opts === null || opts === void 0 ? void 0 : opts.onClick) || (() => void 0);
|
|
78
|
+
this.cancelDelete = (opts === null || opts === void 0 ? void 0 : opts.cancelDelete) || (() => void 0);
|
|
66
79
|
// container
|
|
67
80
|
this.container.classList.add('fpm__delete');
|
|
68
81
|
this.container.style.opacity = '0';
|
|
69
82
|
this.container.style.position = 'absolute';
|
|
70
83
|
this.container.style.left = '0';
|
|
71
|
-
this.container.style.top = '
|
|
84
|
+
this.container.style.top = '10px';
|
|
72
85
|
this.container.style.transform = `translate3d(0, 0, 10px)`;
|
|
73
86
|
this.container.style.pointerEvents = `none`;
|
|
87
|
+
this.container.style.transition = 'top 200ms ease, opacity 200ms ease';
|
|
88
|
+
this.container.style.zIndex = '99';
|
|
74
89
|
// content
|
|
75
90
|
this.content.classList.add('fpm__delete-content');
|
|
76
|
-
this.content.style.width = '
|
|
77
|
-
this.content.style.height = '
|
|
91
|
+
this.content.style.width = '62px';
|
|
92
|
+
this.content.style.height = '26px';
|
|
78
93
|
this.content.style.display = 'flex';
|
|
79
94
|
this.content.style.alignItems = 'center';
|
|
80
95
|
this.content.style.justifyContent = 'center';
|
|
81
96
|
this.content.style.transform = 'translate(-50%, -50%)';
|
|
82
97
|
this.content.style.color = '#fff';
|
|
83
|
-
this.content.style.fontSize = '
|
|
84
|
-
this.content.style.lineHeight = '
|
|
85
|
-
this.content.style.borderRadius = '
|
|
98
|
+
this.content.style.fontSize = '12px';
|
|
99
|
+
this.content.style.lineHeight = '17px';
|
|
100
|
+
this.content.style.borderRadius = '11px';
|
|
86
101
|
this.content.style.backgroundSize = '100% 100%';
|
|
87
102
|
this.content.style.cursor = 'pointer';
|
|
88
103
|
this.content.style.userSelect = 'none';
|
|
@@ -94,22 +109,30 @@ export default class DeleteDom {
|
|
|
94
109
|
this.container.append(this.content);
|
|
95
110
|
const deleteSvgDom = this.content.querySelector('.fpm__delete-icon');
|
|
96
111
|
if (deleteSvgDom) {
|
|
97
|
-
deleteSvgDom.style.width = '
|
|
98
|
-
deleteSvgDom.style.height = '
|
|
99
|
-
deleteSvgDom.style.marginRight = '
|
|
112
|
+
deleteSvgDom.style.width = '16px';
|
|
113
|
+
deleteSvgDom.style.height = '17px';
|
|
114
|
+
deleteSvgDom.style.marginRight = '1px';
|
|
100
115
|
}
|
|
101
116
|
this.content.addEventListener('click', this.onClick);
|
|
102
117
|
this.content.addEventListener('mouseenter', this.onMouseEnter);
|
|
103
118
|
this.content.addEventListener('mouseleave', this.onMouseLeave);
|
|
119
|
+
// masking
|
|
120
|
+
this.masking.setAttribute('style', 'position: absolute;top: 0;left: 0;bottom: 0;right: 0;pointer-events: none;');
|
|
121
|
+
this.masking.addEventListener('click', this.cancelDelete);
|
|
122
|
+
this.masking.addEventListener('touchstart', this.cancelDelete);
|
|
104
123
|
}
|
|
105
124
|
dispose() {
|
|
106
125
|
this.content.removeEventListener('click', this.onClick);
|
|
107
126
|
this.content.removeEventListener('mouseenter', this.onMouseEnter);
|
|
108
127
|
this.content.removeEventListener('mouseleave', this.onMouseLeave);
|
|
109
128
|
this.container.remove();
|
|
129
|
+
this.masking.removeEventListener('click', this.cancelDelete);
|
|
130
|
+
this.masking.removeEventListener('touchstart', this.cancelDelete);
|
|
131
|
+
this.masking.remove();
|
|
110
132
|
}
|
|
111
133
|
appendTo(element) {
|
|
112
134
|
element.append(this.container);
|
|
135
|
+
element.append(this.masking);
|
|
113
136
|
return this;
|
|
114
137
|
}
|
|
115
138
|
setLines(lines) {
|
|
@@ -133,20 +156,34 @@ export default class DeleteDom {
|
|
|
133
156
|
return this;
|
|
134
157
|
const centerScreenX = ((centerX + 1) / 2) * wrapper.clientWidth;
|
|
135
158
|
const maxScreenY = (-(maxY - 1) / 2) * wrapper.clientHeight;
|
|
136
|
-
|
|
137
|
-
|
|
159
|
+
let x = centerScreenX;
|
|
160
|
+
let y = maxScreenY - 34;
|
|
161
|
+
// 只有一条线时且斜率大时删除按钮位于右侧
|
|
162
|
+
if (this.lines.length === 1 && points.length === 2) {
|
|
163
|
+
const k = (yArray[1] - yArray[0]) / (xArray[1] - xArray[0]);
|
|
164
|
+
const centerY = (yArray[1] + yArray[0]) / 2;
|
|
165
|
+
const centerScreenY = (-(centerY - 1) / 2) * wrapper.clientHeight;
|
|
166
|
+
if (Math.abs(k) > 0.4) {
|
|
167
|
+
x = centerScreenX + 57;
|
|
168
|
+
y = centerScreenY;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
138
171
|
this.container.style.transform = `translate3d(${x}px, ${y}px, 10px)`;
|
|
139
172
|
return this.show();
|
|
140
173
|
}
|
|
141
174
|
hide() {
|
|
142
175
|
this.visible = false;
|
|
176
|
+
this.masking.style.pointerEvents = 'none';
|
|
143
177
|
this.container.style.opacity = '0';
|
|
178
|
+
this.container.style.top = '10px';
|
|
144
179
|
this.container.style.pointerEvents = 'none';
|
|
145
180
|
return this;
|
|
146
181
|
}
|
|
147
182
|
show() {
|
|
148
183
|
this.visible = true;
|
|
184
|
+
this.masking.style.pointerEvents = 'auto';
|
|
149
185
|
this.container.style.opacity = '1';
|
|
186
|
+
this.container.style.top = '0';
|
|
150
187
|
this.container.style.pointerEvents = 'auto';
|
|
151
188
|
return this;
|
|
152
189
|
}
|
|
@@ -1,24 +1,59 @@
|
|
|
1
1
|
import type { Five } from '@realsee/five';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import Hammer from 'hammerjs';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { Subscribe, SubscribeEventMap } from '@realsee/five';
|
|
5
|
+
interface MagnifierEvent extends SubscribeEventMap {
|
|
6
|
+
wantsPanGesture: (data: {
|
|
7
|
+
deltaX: number;
|
|
8
|
+
deltaY: number;
|
|
9
|
+
srcEvent: typeof Hammer['Input'];
|
|
10
|
+
}) => boolean;
|
|
11
|
+
}
|
|
12
|
+
/** 放大镜配置参数 */
|
|
13
|
+
export interface MagnifierParameter {
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
scale?: number;
|
|
17
|
+
/** 允许拖动放大镜 */
|
|
18
|
+
dragEnabled?: boolean;
|
|
19
|
+
/** renderWithPoint 时,是否应该自动更新放大镜的位置 */
|
|
20
|
+
autoFixPCPosition?: boolean;
|
|
21
|
+
/** 放大镜初始位置应该设置在容器的哪个位置 */
|
|
22
|
+
initialPosition?: {
|
|
23
|
+
left: string;
|
|
24
|
+
top: string;
|
|
25
|
+
};
|
|
7
26
|
}
|
|
8
27
|
export default class Magnifier {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
visible: boolean;
|
|
31
|
+
hooks: Subscribe<MagnifierEvent>;
|
|
32
|
+
contentDom: HTMLCanvasElement;
|
|
9
33
|
private five;
|
|
10
34
|
private scale;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
private originWidth;
|
|
15
|
-
private originHeight;
|
|
16
|
-
private context;
|
|
35
|
+
private wrapper?;
|
|
36
|
+
private config;
|
|
37
|
+
private offset;
|
|
17
38
|
private canvas;
|
|
18
|
-
private
|
|
19
|
-
|
|
39
|
+
private context;
|
|
40
|
+
private renderCenter;
|
|
41
|
+
private lastPanEvent?;
|
|
42
|
+
private hammer?;
|
|
43
|
+
constructor(five: Five, options: MagnifierParameter);
|
|
20
44
|
dispose(): void;
|
|
45
|
+
/** 移除放大镜 DOM */
|
|
46
|
+
remove(): void;
|
|
47
|
+
/** 清除放大镜渲染内容 */
|
|
21
48
|
clear(): void;
|
|
49
|
+
/** 把放大镜放到某一个容器中 */
|
|
22
50
|
appendTo(element: Element): void;
|
|
23
|
-
|
|
51
|
+
/** 放大传入点位周围的内容 */
|
|
52
|
+
renderWithPoint(point: THREE.Vector3): void;
|
|
53
|
+
private autoFixPCPosition;
|
|
54
|
+
private render;
|
|
55
|
+
private initStyle;
|
|
56
|
+
private onPan;
|
|
57
|
+
private onPanEnd;
|
|
24
58
|
}
|
|
59
|
+
export {};
|
|
@@ -1,153 +1,278 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Hammer from 'hammerjs';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import '../../shared-utils';
|
|
4
|
+
import { Subscribe } from '@realsee/five';
|
|
2
5
|
/** 交换数组元素 */
|
|
3
6
|
function exchange(array, index1, index2) {
|
|
4
7
|
const value = array[index1];
|
|
5
8
|
array[index1] = array[index2];
|
|
6
9
|
array[index2] = value;
|
|
7
10
|
}
|
|
11
|
+
/** 翻转 ArrayBuffer(RGBA像素) 的 Y 轴 */
|
|
12
|
+
function flipPixelsY(pixels, width, height) {
|
|
13
|
+
const flipYLength = height / 2;
|
|
14
|
+
for (let currentHeight = 1; currentHeight <= flipYLength; currentHeight++) {
|
|
15
|
+
const targetHeight = height - (currentHeight - 1);
|
|
16
|
+
for (let currentWidth = 1; currentWidth <= width; currentWidth++) {
|
|
17
|
+
const pixelIndex = (currentHeight - 1) * width + currentWidth - 1;
|
|
18
|
+
const targetPixelIndex = (targetHeight - 1) * width + currentWidth - 1;
|
|
19
|
+
exchange(pixels, pixelIndex * 4 + 0, targetPixelIndex * 4 + 0);
|
|
20
|
+
exchange(pixels, pixelIndex * 4 + 1, targetPixelIndex * 4 + 1);
|
|
21
|
+
exchange(pixels, pixelIndex * 4 + 2, targetPixelIndex * 4 + 2);
|
|
22
|
+
exchange(pixels, pixelIndex * 4 + 3, targetPixelIndex * 4 + 3);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
8
26
|
export default class Magnifier {
|
|
9
27
|
constructor(five, options) {
|
|
10
|
-
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
Object.defineProperty(this, "width", {
|
|
11
30
|
enumerable: true,
|
|
12
31
|
configurable: true,
|
|
13
32
|
writable: true,
|
|
14
33
|
value: void 0
|
|
15
34
|
});
|
|
16
|
-
Object.defineProperty(this, "
|
|
35
|
+
Object.defineProperty(this, "height", {
|
|
17
36
|
enumerable: true,
|
|
18
37
|
configurable: true,
|
|
19
38
|
writable: true,
|
|
20
39
|
value: void 0
|
|
21
40
|
});
|
|
22
|
-
Object.defineProperty(this, "
|
|
41
|
+
Object.defineProperty(this, "visible", {
|
|
23
42
|
enumerable: true,
|
|
24
43
|
configurable: true,
|
|
25
44
|
writable: true,
|
|
26
|
-
value:
|
|
45
|
+
value: false
|
|
27
46
|
});
|
|
28
|
-
Object.defineProperty(this, "
|
|
47
|
+
Object.defineProperty(this, "hooks", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: new Subscribe()
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(this, "contentDom", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: document.createElement('canvas')
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(this, "five", {
|
|
29
60
|
enumerable: true,
|
|
30
61
|
configurable: true,
|
|
31
62
|
writable: true,
|
|
32
63
|
value: void 0
|
|
33
64
|
});
|
|
34
|
-
Object.defineProperty(this, "
|
|
65
|
+
Object.defineProperty(this, "scale", {
|
|
35
66
|
enumerable: true,
|
|
36
67
|
configurable: true,
|
|
37
68
|
writable: true,
|
|
38
69
|
value: void 0
|
|
39
70
|
});
|
|
40
|
-
Object.defineProperty(this, "
|
|
71
|
+
Object.defineProperty(this, "wrapper", {
|
|
41
72
|
enumerable: true,
|
|
42
73
|
configurable: true,
|
|
43
74
|
writable: true,
|
|
44
75
|
value: void 0
|
|
45
76
|
});
|
|
46
|
-
Object.defineProperty(this, "
|
|
77
|
+
Object.defineProperty(this, "config", {
|
|
47
78
|
enumerable: true,
|
|
48
79
|
configurable: true,
|
|
49
80
|
writable: true,
|
|
50
81
|
value: void 0
|
|
51
82
|
});
|
|
83
|
+
Object.defineProperty(this, "offset", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: { x: 0, y: 0 }
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(this, "canvas", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
configurable: true,
|
|
92
|
+
writable: true,
|
|
93
|
+
value: this.contentDom
|
|
94
|
+
});
|
|
52
95
|
Object.defineProperty(this, "context", {
|
|
53
96
|
enumerable: true,
|
|
54
97
|
configurable: true,
|
|
55
98
|
writable: true,
|
|
56
99
|
value: void 0
|
|
57
100
|
});
|
|
58
|
-
Object.defineProperty(this, "
|
|
101
|
+
Object.defineProperty(this, "renderCenter", {
|
|
59
102
|
enumerable: true,
|
|
60
103
|
configurable: true,
|
|
61
104
|
writable: true,
|
|
62
|
-
value:
|
|
105
|
+
value: new THREE.Vector3()
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(this, "lastPanEvent", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
configurable: true,
|
|
110
|
+
writable: true,
|
|
111
|
+
value: void 0
|
|
63
112
|
});
|
|
64
|
-
Object.defineProperty(this, "
|
|
113
|
+
Object.defineProperty(this, "hammer", {
|
|
65
114
|
enumerable: true,
|
|
66
115
|
configurable: true,
|
|
67
116
|
writable: true,
|
|
68
117
|
value: void 0
|
|
69
118
|
});
|
|
119
|
+
Object.defineProperty(this, "onPan", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
configurable: true,
|
|
122
|
+
writable: true,
|
|
123
|
+
value: (event) => {
|
|
124
|
+
var _a, _b, _c, _d;
|
|
125
|
+
if (!this.wrapper)
|
|
126
|
+
return;
|
|
127
|
+
const lastDeltaX = (_b = (_a = this.lastPanEvent) === null || _a === void 0 ? void 0 : _a.deltaX) !== null && _b !== void 0 ? _b : 0;
|
|
128
|
+
const lastDeltaY = (_d = (_c = this.lastPanEvent) === null || _c === void 0 ? void 0 : _c.deltaY) !== null && _d !== void 0 ? _d : 0;
|
|
129
|
+
const deltaX = event.deltaX - lastDeltaX;
|
|
130
|
+
const deltaY = event.deltaY - lastDeltaY;
|
|
131
|
+
this.lastPanEvent = event;
|
|
132
|
+
const prevented = this.hooks.emit('wantsPanGesture', { srcEvent: event, deltaX, deltaY });
|
|
133
|
+
if (prevented)
|
|
134
|
+
return;
|
|
135
|
+
const translateX = this.offset.x + deltaX;
|
|
136
|
+
const translateY = this.offset.y + deltaY;
|
|
137
|
+
this.contentDom.style.boxShadow = '0 2px 30px 0 rgba(0,0,0,0.20)';
|
|
138
|
+
this.canvas.style.transform = `translate3d(${translateX}px, ${translateY}px, 100px)`;
|
|
139
|
+
this.offset = { x: translateX, y: translateY };
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(this, "onPanEnd", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
configurable: true,
|
|
145
|
+
writable: true,
|
|
146
|
+
value: (event) => {
|
|
147
|
+
this.lastPanEvent = undefined;
|
|
148
|
+
this.contentDom.style.boxShadow = 'none';
|
|
149
|
+
}
|
|
150
|
+
});
|
|
70
151
|
if (!five.renderer)
|
|
71
152
|
throw new Error('Five Render 未初始化');
|
|
72
153
|
this.five = five;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
154
|
+
this.scale = (_a = options === null || options === void 0 ? void 0 : options.scale) !== null && _a !== void 0 ? _a : 2;
|
|
155
|
+
this.width = (_b = options === null || options === void 0 ? void 0 : options.width) !== null && _b !== void 0 ? _b : 190;
|
|
156
|
+
this.height = (_c = options === null || options === void 0 ? void 0 : options.height) !== null && _c !== void 0 ? _c : 190;
|
|
157
|
+
this.config = {
|
|
158
|
+
dragEnabled: (options === null || options === void 0 ? void 0 : options.dragEnabled) || false,
|
|
159
|
+
autoFixPCPosition: (options === null || options === void 0 ? void 0 : options.autoFixPCPosition) || false,
|
|
160
|
+
initialPosition: (options === null || options === void 0 ? void 0 : options.initialPosition) || { left: '0', top: '0' },
|
|
161
|
+
};
|
|
80
162
|
const context = this.canvas.getContext('2d');
|
|
81
163
|
if (!context)
|
|
82
164
|
throw new Error('CANNOT CREATE CONTEXT2D');
|
|
83
|
-
this.scale = scale;
|
|
84
165
|
this.context = context;
|
|
85
|
-
this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
magnifier.style.position = 'absolute';
|
|
92
|
-
magnifier.style.pointerEvents = 'none';
|
|
93
|
-
magnifier.style.borderRadius = '50%';
|
|
94
|
-
magnifier.style.left = -width / 2 + 'px';
|
|
95
|
-
magnifier.style.top = -height - 90 + 'px';
|
|
96
|
-
magnifier.setAttribute('width', width.toString());
|
|
97
|
-
magnifier.setAttribute('height', height.toString());
|
|
98
|
-
this.canvas.style.width = originWidth + 'px';
|
|
99
|
-
this.canvas.style.height = originHeight + 'px';
|
|
166
|
+
if (this.config.dragEnabled) {
|
|
167
|
+
this.hammer = new Hammer(this.canvas);
|
|
168
|
+
this.hammer.on('pan', this.onPan);
|
|
169
|
+
this.hammer.on('panend', this.onPanEnd);
|
|
170
|
+
// this.hooks.on('wantsPanGesture', this.onMagnifierWantsPanGesture)
|
|
171
|
+
}
|
|
100
172
|
}
|
|
101
173
|
dispose() {
|
|
174
|
+
var _a;
|
|
102
175
|
this.clear();
|
|
176
|
+
this.remove();
|
|
177
|
+
(_a = this.hammer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
178
|
+
}
|
|
179
|
+
/** 移除放大镜 DOM */
|
|
180
|
+
remove() {
|
|
103
181
|
this.canvas.remove();
|
|
182
|
+
this.visible = false;
|
|
104
183
|
}
|
|
184
|
+
/** 清除放大镜渲染内容 */
|
|
105
185
|
clear() {
|
|
106
186
|
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
107
187
|
}
|
|
188
|
+
/** 把放大镜放到某一个容器中 */
|
|
108
189
|
appendTo(element) {
|
|
109
|
-
this.
|
|
190
|
+
this.wrapper = element;
|
|
191
|
+
this.initStyle();
|
|
110
192
|
element.append(this.canvas);
|
|
193
|
+
this.visible = true;
|
|
111
194
|
}
|
|
112
|
-
|
|
113
|
-
|
|
195
|
+
/** 放大传入点位周围的内容 */
|
|
196
|
+
renderWithPoint(point) {
|
|
197
|
+
if (!this.wrapper)
|
|
114
198
|
return;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
199
|
+
this.renderCenter = point;
|
|
200
|
+
this.render();
|
|
201
|
+
if (this.config.autoFixPCPosition)
|
|
202
|
+
this.autoFixPCPosition();
|
|
203
|
+
}
|
|
204
|
+
autoFixPCPosition() {
|
|
205
|
+
if (!this.wrapper)
|
|
206
|
+
return;
|
|
207
|
+
const { width, height } = this;
|
|
208
|
+
const position2d = this.renderCenter.clone().project(this.five.camera);
|
|
209
|
+
const left = ((position2d.x + 1) / 2) * this.wrapper.clientWidth;
|
|
210
|
+
const right = (-(position2d.x - 1) / 2) * this.wrapper.clientWidth;
|
|
211
|
+
const top = (-(position2d.y - 1) / 2) * this.wrapper.clientHeight;
|
|
120
212
|
if (left < 183) {
|
|
121
|
-
this.canvas.style.top = -
|
|
213
|
+
this.canvas.style.top = -height / 2 + 'px';
|
|
122
214
|
this.canvas.style.left = 90 + 'px';
|
|
123
215
|
}
|
|
124
216
|
else if (top < 183) {
|
|
125
217
|
this.canvas.style.top = 90 + 'px';
|
|
126
|
-
this.canvas.style.left = -
|
|
218
|
+
this.canvas.style.left = -width / 2 + 'px';
|
|
127
219
|
}
|
|
128
220
|
else if (right < 183) {
|
|
129
|
-
this.canvas.style.top = -
|
|
130
|
-
this.canvas.style.left = -
|
|
221
|
+
this.canvas.style.top = -height / 2 + 'px';
|
|
222
|
+
this.canvas.style.left = -width - 90 + 'px';
|
|
131
223
|
}
|
|
132
224
|
else {
|
|
133
|
-
this.canvas.style.left = -
|
|
134
|
-
this.canvas.style.top = -
|
|
225
|
+
this.canvas.style.left = -width / 2 + 'px';
|
|
226
|
+
this.canvas.style.top = -height - 90 + 'px';
|
|
135
227
|
}
|
|
136
228
|
this.canvas.style.transform = `translate3d(${left}px, ${top}px, 10px)`;
|
|
137
|
-
|
|
229
|
+
this.offset = { x: left, y: top };
|
|
230
|
+
}
|
|
231
|
+
render() {
|
|
232
|
+
if (!this.five.renderer || !this.wrapper)
|
|
233
|
+
return;
|
|
234
|
+
const { scale, context, width, height } = this;
|
|
235
|
+
const position2d = this.renderCenter.clone().project(this.five.camera);
|
|
236
|
+
const renderSize = this.five.renderer.getSize(new THREE.Vector2());
|
|
237
|
+
// const pixelRatio = this.five.renderer.getPixelRatio()
|
|
238
|
+
// 安卓机型和ios部分机型在app里读不到像素,固定为1降低清晰度可以读到
|
|
239
|
+
const pixelRatio = 1;
|
|
240
|
+
// 从 renderTarget 读取区域的大小
|
|
241
|
+
const readPixelsWidth = width / scale;
|
|
242
|
+
const readPixelsHeight = height / scale;
|
|
243
|
+
// 一个像素重复多少倍,pixelRatio 是兼容屏幕像素比,scale 是真实重复倍数
|
|
244
|
+
const readPixelsRadio = pixelRatio * scale;
|
|
138
245
|
const x = ((position2d.x + 1) / 2) * renderSize.x;
|
|
139
246
|
const y = ((position2d.y + 1) / 2) * renderSize.y;
|
|
140
|
-
const pixels = this.five.getPixels(x -
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
const imageData = context.createImageData(width, height);
|
|
247
|
+
const pixels = this.five.getPixels(x - readPixelsWidth / 2, y - readPixelsWidth / 2, readPixelsWidth, readPixelsHeight, readPixelsRadio);
|
|
248
|
+
// 最后生成的图像大小是 [width * pixelRatio, height * pixelRatio]
|
|
249
|
+
// 绘制在[width, height]的区域上
|
|
250
|
+
const imageWidth = Math.floor(width * pixelRatio);
|
|
251
|
+
const imageHeight = Math.floor(height * pixelRatio);
|
|
252
|
+
// 因为 Canvas 与 THREE Renderer Y 坐标相反,所以需要 Y 轴翻转
|
|
253
|
+
flipPixelsY(pixels, imageWidth, imageHeight);
|
|
254
|
+
const imageData = new ImageData(imageWidth, imageHeight);
|
|
150
255
|
imageData.data.set(pixels);
|
|
151
256
|
context.putImageData(imageData, 0, 0);
|
|
152
257
|
}
|
|
258
|
+
initStyle() {
|
|
259
|
+
const canvas = this.canvas;
|
|
260
|
+
canvas.classList.add('five-plugin__magnifier');
|
|
261
|
+
canvas.style.position = 'absolute';
|
|
262
|
+
canvas.style.pointerEvents = 'all';
|
|
263
|
+
canvas.style.borderRadius = '50%';
|
|
264
|
+
canvas.style.zIndex = '99';
|
|
265
|
+
const pixelRatio = 1;
|
|
266
|
+
canvas.setAttribute('width', (this.width * pixelRatio).toString());
|
|
267
|
+
canvas.setAttribute('height', (this.height * pixelRatio).toString());
|
|
268
|
+
canvas.style.border = '2px solid rgba(255,255,255,0.20)';
|
|
269
|
+
canvas.style.width = this.width + 'px';
|
|
270
|
+
canvas.style.height = this.height + 'px';
|
|
271
|
+
canvas.style.top = this.config.initialPosition.top;
|
|
272
|
+
canvas.style.left = this.config.initialPosition.left;
|
|
273
|
+
canvas.style.transform = 'translate(0,0,100px)';
|
|
274
|
+
if (this.config.dragEnabled) {
|
|
275
|
+
this.canvas.style.cursor = 'pointer';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
153
278
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TWEEN from '@tweenjs/tween.js';
|
|
2
|
-
import { mainIconStyle
|
|
2
|
+
import { mainIconStyle, mainItemStyle } from './style';
|
|
3
3
|
import { tweenProgress } from '../../../shared-utils/animationFrame/BetterTween';
|
|
4
4
|
import { MAIN_NORMAL_PATH, MAIN_DONE_PATH, MAIN_MOUSE_ENTER_FILL, MAIN_MOUSE_LEAVE_FILL } from './HTML';
|
|
5
5
|
export class MainBtnController {
|