@realsee/dnalogel 2.0.0-alpha.43 → 2.0.0-alpha.44

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 (164) hide show
  1. package/dist/CSS3DRenderPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  2. package/dist/CameraMovementPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  3. package/dist/ItemLabelPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  4. package/dist/ItemLabelPlugin/index.js +138 -73
  5. package/dist/ItemLabelPlugin/typings.d.ts +1 -0
  6. package/dist/ModelChassisCompassPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  7. package/dist/ModelEntryDoorGuidePlugin/ItemLabelPlugin/typings.d.ts +1 -0
  8. package/dist/ModelItemLabelPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  9. package/dist/ModelRoomLabelPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  10. package/dist/ModelTVVideoPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  11. package/dist/ModelViewPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  12. package/dist/PanoCompassPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  13. package/dist/PanoCursorRaycasterPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  14. package/dist/PanoMeasurePlugin/ItemLabelPlugin/typings.d.ts +1 -0
  15. package/dist/PanoRulerPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  16. package/dist/PanoRulerProPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  17. package/dist/PanoSpatialTagPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  18. package/dist/floorplan/ModelFloorplanPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  19. package/dist/floorplan/PanoFloorplanRadarPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  20. package/dist/floorplan/TopviewFloorplanPlugin/ItemLabelPlugin/typings.d.ts +1 -0
  21. package/dist/index.es.js +156 -91
  22. package/dist/index.js +156 -91
  23. package/dist/index.umd.js +156 -91
  24. package/docs/classes/Magnifier.html +4 -4
  25. package/docs/classes/ModelRoomLabelController.html +4 -4
  26. package/docs/enums/CameraMovementEffect.html +1 -1
  27. package/docs/enums/DIRECTION.html +1 -1
  28. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  29. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  30. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  31. package/docs/enums/Rotation.html +1 -1
  32. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  33. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  34. package/docs/interfaces/FloorplanBounding.html +3 -3
  35. package/docs/interfaces/FloorplanData.html +1 -1
  36. package/docs/interfaces/FloorplanEntrance.html +6 -6
  37. package/docs/interfaces/FloorplanExtraObject.html +2 -2
  38. package/docs/interfaces/FloorplanExtraObject3D.html +1 -1
  39. package/docs/interfaces/FloorplanFloorData.html +1 -1
  40. package/docs/interfaces/FloorplanImagePosition.html +1 -1
  41. package/docs/interfaces/FloorplanObserver.html +1 -1
  42. package/docs/interfaces/FloorplanOutlineItem.html +1 -1
  43. package/docs/interfaces/FloorplanPosition.html +1 -1
  44. package/docs/interfaces/FloorplanRoomItem.html +5 -5
  45. package/docs/interfaces/FloorplanRoomLabelItem.html +2 -2
  46. package/docs/interfaces/FloorplanServerBounding.html +3 -3
  47. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  48. package/docs/interfaces/FloorplanServerData.html +1 -1
  49. package/docs/interfaces/FloorplanServerEntrance.html +6 -6
  50. package/docs/interfaces/FloorplanServerFloorData.html +1 -1
  51. package/docs/interfaces/FloorplanServerImagePosition.html +1 -1
  52. package/docs/interfaces/FloorplanServerObserver.html +1 -1
  53. package/docs/interfaces/FloorplanServerOutlineItem.html +1 -1
  54. package/docs/interfaces/FloorplanServerPosition.html +1 -1
  55. package/docs/interfaces/FloorplanServerRoomItem.html +6 -6
  56. package/docs/interfaces/FloorplanServerRoomLabelItem.html +2 -2
  57. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  58. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  59. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  60. package/docs/interfaces/LineJson.html +1 -1
  61. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  62. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  63. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  64. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  65. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  66. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  67. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  68. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  69. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  70. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  71. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  72. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  73. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  74. package/docs/interfaces/OpenParameter.html +1 -1
  75. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  76. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  77. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  78. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  79. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  80. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  81. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  82. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  83. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  84. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  85. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  86. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  87. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  88. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  89. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  90. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  91. package/docs/interfaces/Point.html +1 -1
  92. package/docs/interfaces/PointJson.html +1 -1
  93. package/docs/interfaces/Room.html +1 -1
  94. package/docs/interfaces/RoomInfo.html +1 -1
  95. package/docs/interfaces/RoomLabel.html +7 -7
  96. package/docs/modules.html +18 -18
  97. package/libs/ItemLabelPlugin/ItemLabelComponent.js +2 -2
  98. package/libs/ItemLabelPlugin/ItemLabelComponent.svelte +251 -0
  99. package/libs/ItemLabelPlugin/ItemLabelItem.js +141 -74
  100. package/libs/ItemLabelPlugin/ItemLabelItem.svelte +180 -0
  101. package/libs/ItemLabelPlugin/Plugin.js +1 -1
  102. package/libs/ItemLabelPlugin/typings.d.ts +3 -1
  103. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +2 -2
  104. package/libs/ModelItemLabelPlugin/ItemLabelComponent.svelte +155 -0
  105. package/libs/ModelItemLabelPlugin/ItemLabelItem.js +6 -6
  106. package/libs/ModelItemLabelPlugin/ItemLabelItem.svelte +100 -0
  107. package/libs/ModelItemLabelPlugin/ModelItemLabelPlugin.js +1 -1
  108. package/libs/ModelItemLabelPlugin/typings.d.ts +1 -1
  109. package/libs/ModelRoomLabelPlugin/Controller.js +1 -1
  110. package/libs/ModelRoomLabelPlugin/RoomLabelItem.js +4 -4
  111. package/libs/ModelRoomLabelPlugin/RoomLabelItem.svelte +63 -0
  112. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +2 -2
  113. package/libs/ModelRoomLabelPlugin/RoomLabelItems.svelte +94 -0
  114. package/libs/PanoRulerProPlugin/Controller.js +1 -1
  115. package/libs/PanoRulerProPlugin/RulerItem.js +9 -9
  116. package/libs/PanoRulerProPlugin/RulerItem.svelte +166 -0
  117. package/libs/PanoRulerProPlugin/RulerItems.svelte +212 -0
  118. package/libs/PanoSpatialTagPlugin/Components/origins.js +2 -2
  119. package/libs/PanoSpatialTagPlugin/Components/origins.svelte +58 -0
  120. package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
  121. package/libs/PanoSpatialTagPlugin/Components/tag.svelte +292 -0
  122. package/libs/PanoSpatialTagPlugin/Plugin.js +2 -2
  123. package/libs/floorplan/Components/BaseImage.js +2 -2
  124. package/libs/floorplan/Components/BaseImage.svelte +26 -0
  125. package/libs/floorplan/Components/Camera.js +3 -3
  126. package/libs/floorplan/Components/Camera.svelte +46 -0
  127. package/libs/floorplan/Components/Compass.js +4 -4
  128. package/libs/floorplan/Components/Compass.svelte +51 -0
  129. package/libs/floorplan/Components/CurrentFloor.js +3 -3
  130. package/libs/floorplan/Components/CurrentFloor.svelte +46 -0
  131. package/libs/floorplan/Components/Main.js +2 -2
  132. package/libs/floorplan/Components/Main.svelte +51 -0
  133. package/libs/floorplan/Components/Normalmage.js +2 -2
  134. package/libs/floorplan/Components/Normalmage.svelte +11 -0
  135. package/libs/floorplan/Components/RoomHighlight/Room.js +2 -2
  136. package/libs/floorplan/Components/RoomHighlight/Room.svelte +27 -0
  137. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -3
  138. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.svelte +29 -0
  139. package/libs/floorplan/Components/RoomLabels/RoomLabel.js +3 -3
  140. package/libs/floorplan/Components/RoomLabels/RoomLabel.svelte +119 -0
  141. package/libs/floorplan/Components/RoomLabels/RoomLabels.js +2 -2
  142. package/libs/floorplan/Components/RoomLabels/RoomLabels.svelte +35 -0
  143. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +3 -3
  144. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.svelte +42 -0
  145. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_0.svelte +7 -0
  146. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_1.svelte +24 -0
  147. package/libs/floorplan/Components/RoomMaterials/RoomMaterial_2.svelte +33 -0
  148. package/libs/floorplan/Components/RuleLabels/RuleItem.js +9 -9
  149. package/libs/floorplan/Components/RuleLabels/RuleItem.svelte +174 -0
  150. package/libs/floorplan/Components/RuleLabels/RuleLabels.js +2 -2
  151. package/libs/floorplan/Components/RuleLabels/RuleLabels.svelte +32 -0
  152. package/libs/floorplan/Components/SvgImage.js +3 -4
  153. package/libs/floorplan/Components/SvgImage.svelte +28 -0
  154. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +1 -1
  155. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.js +4 -4
  156. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Camera.svelte +85 -0
  157. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.svelte +18 -0
  158. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.js +4 -4
  159. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/ExtraObjects.svelte +40 -0
  160. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.js +3 -3
  161. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/Main.svelte +64 -0
  162. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +1 -1
  163. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +1 -1
  164. package/package.json +2 -1
@@ -0,0 +1,174 @@
1
+ <script>export let type;
2
+ export let data;
3
+ export let bounding;
4
+ const isRow = type === 'top' || type === 'bottom';
5
+ const padding = 1000;
6
+ const exteriorWallOffset = 180;
7
+ const contentWidth = bounding.max.x - bounding.min.x - (padding - exteriorWallOffset) * 2;
8
+ const contentHeight = bounding.max.y - bounding.min.y - (padding - exteriorWallOffset) * 2;
9
+ // 计算每一段墙的长度,以及墙两侧点距离标尺初始点的像素值
10
+ const rulerPoints = data
11
+ .map(([start, end]) => (isRow ? [start.x, end.x] : [start.y, end.y]))
12
+ .flat()
13
+ .sort()
14
+ .filter((x, index, arr) => {
15
+ // 筛除重复数据
16
+ if (index === 0)
17
+ return true;
18
+ return x !== arr[index - 1];
19
+ });
20
+ const rulerLabels = rulerPoints.map((num) => {
21
+ const left = isRow ? (num - bounding.min.x - padding + exteriorWallOffset) / contentWidth : 0;
22
+ const bottom = !isRow ? (num - bounding.min.y - padding + exteriorWallOffset) / contentHeight : 0;
23
+ return { left, bottom };
24
+ });
25
+ rulerLabels.unshift({ left: 0, bottom: 0 });
26
+ rulerLabels.push(isRow ? { left: 1, bottom: 0 } : { left: 0, bottom: 1 });
27
+ const length = rulerPoints[rulerPoints.length - 1] - rulerPoints[0];
28
+ const rulerTexts = rulerPoints
29
+ .map((num, index, arr) => {
30
+ const distance = index === 0 ? 0 : num - arr[index - 1];
31
+ const positionNum = index === 0 ? 0 : (num + arr[index - 1]) / 2;
32
+ const left = isRow ? (positionNum - bounding.min.x - padding + exteriorWallOffset) / contentWidth : 0;
33
+ const bottom = !isRow ? (positionNum - bounding.min.y - padding + exteriorWallOffset) / contentHeight : 0;
34
+ return { left, bottom, distance };
35
+ })
36
+ .filter(({ distance }) => distance / length > 0.1);
37
+ </script>
38
+
39
+ <div
40
+ class="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--{type}"
41
+ class:is-row={isRow}
42
+ style:width={isRow ? '100%' : 1 / 16 + 'rem'}
43
+ style:height={!isRow ? '100%' : 1 / 16 + 'rem'}
44
+ >
45
+ <div class="floorplan-plugin__rule-line" />
46
+ <div class="floorplan-plugin__rule-scale-wrapper" class:is-row={isRow}>
47
+ {#each rulerLabels as rulerLabel}
48
+ <div
49
+ class="floorplan-plugin__rule-scale"
50
+ style:left={rulerLabel.left * 100 + '%'}
51
+ style:bottom={rulerLabel.bottom * 100 + '%'}
52
+ />
53
+ {/each}
54
+ </div>
55
+ <div class="floorplan-plugin__rule-text-wrapper">
56
+ {#each rulerTexts as textItem, textItemIndex (textItemIndex)}
57
+ <div
58
+ class="floorplan-plugin__rule-text-item"
59
+ style:left={textItem.left * 100 + '%'}
60
+ style:bottom={textItem.bottom * 100 + '%'}
61
+ >
62
+ <div class="floorplan-plugin__rule-text" class:is-row={isRow}>
63
+ {textItem.distance}
64
+ </div>
65
+ </div>
66
+ {/each}
67
+ </div>
68
+ </div>
69
+
70
+ <style>
71
+ .floorplan-plugin__rule-labels {
72
+ position: absolute;
73
+ display: flex;
74
+ }
75
+ .floorplan-plugin__rule-labels--top {
76
+ left: 0;
77
+ top: -1.25rem;
78
+ }
79
+ .floorplan-plugin__rule-labels--bottom {
80
+ left: 0;
81
+ bottom: -1.25rem;
82
+ }
83
+ .floorplan-plugin__rule-labels--left {
84
+ top: 0;
85
+ left: -1.25rem;
86
+ }
87
+ .floorplan-plugin__rule-labels--right {
88
+ top: 0;
89
+ right: -1.25rem;
90
+ }
91
+
92
+ .floorplan-plugin__rule-line {
93
+ background: #fff;
94
+ opacity: 0.05;
95
+ width: 100%;
96
+ height: 100%;
97
+ }
98
+
99
+ .floorplan-plugin__rule-scale-wrapper {
100
+ position: absolute;
101
+ /* 5px */
102
+ width: 0.3125rem;
103
+ height: 100%;
104
+ left: 50%;
105
+ top: 0;
106
+ transform: translateX(-50%);
107
+ }
108
+ .floorplan-plugin__rule-labels.is-row .floorplan-plugin__rule-scale-wrapper {
109
+ width: 100%;
110
+ /* 5px */
111
+ height: 0.3125rem;
112
+ top: 50%;
113
+ left: 0;
114
+ transform: translateY(-50%);
115
+ }
116
+ .floorplan-plugin__rule-scale {
117
+ position: absolute;
118
+ background: #fff;
119
+ opacity: 0.05;
120
+ width: 100%;
121
+ /* 1px */
122
+ height: 0.0625rem;
123
+ }
124
+ .floorplan-plugin__rule-labels.is-row .floorplan-plugin__rule-scale {
125
+ /* 1px */
126
+ width: 0.0625rem;
127
+ height: 100%;
128
+ }
129
+
130
+ .floorplan-plugin__rule-text-wrapper {
131
+ position: absolute;
132
+ }
133
+ .floorplan-plugin__rule-labels--top .floorplan-plugin__rule-text-wrapper {
134
+ width: 100%;
135
+ height: 0;
136
+ /* 10px */
137
+ top: 0.625rem;
138
+ }
139
+ .floorplan-plugin__rule-labels--bottom .floorplan-plugin__rule-text-wrapper {
140
+ width: 100%;
141
+ height: 0;
142
+ /* 10px */
143
+ bottom: 0.625rem;
144
+ }
145
+ .floorplan-plugin__rule-labels--left .floorplan-plugin__rule-text-wrapper {
146
+ width: 0;
147
+ height: 100%;
148
+ /* 10px */
149
+ left: 0.625rem;
150
+ }
151
+ .floorplan-plugin__rule-labels--right .floorplan-plugin__rule-text-wrapper {
152
+ width: 0;
153
+ height: 100%;
154
+ /* 10px */
155
+ right: 0.625rem;
156
+ }
157
+ .floorplan-plugin__rule-text-item {
158
+ width: 0;
159
+ height: 0;
160
+ position: absolute;
161
+ transform: rotate(90deg);
162
+ }
163
+ .floorplan-plugin__rule-labels.is-row .floorplan-plugin__rule-text-item {
164
+ transform: rotate(0);
165
+ }
166
+ .floorplan-plugin__rule-text {
167
+ width: max-content;
168
+ transform: translate(-50%, -50%);
169
+ /* 10px */
170
+ font-size: 0.625rem;
171
+ color: #fff;
172
+ opacity: 0.2;
173
+ }
174
+ </style>
@@ -26,7 +26,7 @@ import {
26
26
  import RuleItem from './RuleItem';
27
27
 
28
28
  function add_css(target) {
29
- append_styles(target, "svelte-12vlcaz", ".floorplan-plugin__rule-labels-wrapper.svelte-12vlcaz{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}");
29
+ append_styles(target, "svelte-1mzj9p3", ".floorplan-plugin__rule-labels-wrapper.svelte-1mzj9p3{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}");
30
30
  }
31
31
 
32
32
  function get_each_context(ctx, list, i) {
@@ -124,7 +124,7 @@ function create_fragment(ctx) {
124
124
  each_blocks[i].c();
125
125
  }
126
126
 
127
- attr(div, "class", "floorplan-plugin__rule-labels-wrapper svelte-12vlcaz");
127
+ attr(div, "class", "floorplan-plugin__rule-labels-wrapper svelte-1mzj9p3");
128
128
  set_style(div, "width", /*width*/ ctx[2], false);
129
129
  set_style(div, "height", /*height*/ ctx[1], false);
130
130
  },
@@ -0,0 +1,32 @@
1
+ <script>import RuleItem from './RuleItem.svelte';
2
+ export let floorIndex;
3
+ export let floorplanData;
4
+ const padding = 1000;
5
+ const exteriorWallOffset = 180;
6
+ $: bounding = floorplanData.bounding;
7
+ $: ruleLabelData = floorplanData.floorDatas[floorIndex].rules;
8
+ $: ruleLabelDataKeys = Object.keys(ruleLabelData);
9
+ $: ruleLabelArray = ruleLabelDataKeys.map((key) => [key, ruleLabelData[key]]);
10
+ $: boundingWidth = bounding.max.x - bounding.min.x;
11
+ $: boundingHeight = bounding.max.y - bounding.min.y;
12
+ $: contentWidth = bounding.max.x - bounding.min.x - (padding - exteriorWallOffset) * 2;
13
+ $: contentHeight = bounding.max.y - bounding.min.y - (padding - exteriorWallOffset) * 2;
14
+ $: width = (contentWidth / boundingWidth) * 100 + '%';
15
+ $: height = (contentHeight / boundingHeight) * 100 + '%';
16
+ </script>
17
+
18
+ <div class="floorplan-plugin__rule-labels-wrapper" style:width style:height>
19
+ {#each ruleLabelArray as [type, data] (type)}
20
+ <RuleItem {...{ type, data, bounding }} />
21
+ {/each}
22
+ </div>
23
+
24
+ <style>
25
+ .floorplan-plugin__rule-labels-wrapper {
26
+ position: absolute;
27
+ top: 50%;
28
+ left: 50%;
29
+ transform: translate(-50%, -50%);
30
+ pointer-events: none;
31
+ }
32
+ </style>
@@ -15,7 +15,7 @@ import {
15
15
  } from "svelte/internal";
16
16
 
17
17
  function add_css(target) {
18
- append_styles(target, "svelte-1qqy56u", ".floorplan-plugin__base-image.svelte-1qqy56u{width:100%;height:100%}");
18
+ append_styles(target, "svelte-ub47ya", ".floorplan-plugin__base-image.svelte-ub47ya{width:100%;height:100%}");
19
19
  }
20
20
 
21
21
  function create_fragment(ctx) {
@@ -32,7 +32,7 @@ function create_fragment(ctx) {
32
32
  html_tag_1 = new HtmlTag(false);
33
33
  html_tag.a = t;
34
34
  html_tag_1.a = null;
35
- attr(div, "class", "floorplan-plugin__base-image svelte-1qqy56u");
35
+ attr(div, "class", "floorplan-plugin__base-image svelte-ub47ya");
36
36
  },
37
37
  m(target, anchor) {
38
38
  insert(target, div, anchor);
@@ -62,8 +62,7 @@ function instance($$self, $$props, $$invalidate) {
62
62
  }
63
63
  svg [type='lineItemGroup'] g g g g {
64
64
  stroke: #ffffff;
65
- }
66
- </style>
65
+ }</style>
67
66
  `;
68
67
 
69
68
  $$self.$$set = $$props => {
@@ -0,0 +1,28 @@
1
+ <script>export let content;
2
+ const svgStyle = `
3
+ <style>
4
+ svg [type='lineGroup'] path {
5
+ fill: #ffffff;
6
+ stroke: #ffffff;
7
+ }
8
+ svg [type='lineItemGroup'] g g g g {
9
+ stroke: #ffffff;
10
+ }
11
+ </style>
12
+ `;
13
+ </script>
14
+
15
+ <div class="floorplan-plugin__base-image">
16
+ <!-- TODO: @html 是一个很不好的语法,但是目前没有好的方式去配置 User DOM -->
17
+ <!-- TODO: 看一下能不能改成在 reactive segment 里动态插入 DOM -->
18
+ <!-- eslint-disable svelte/no-at-html-tags -->
19
+ {@html svgStyle}
20
+ {@html content}
21
+ </div>
22
+
23
+ <style>
24
+ .floorplan-plugin__base-image {
25
+ width: 100%;
26
+ height: 100%;
27
+ }
28
+ </style>
@@ -1,6 +1,6 @@
1
1
  import to from '../../shared-utils/to';
2
2
  import equal from '../../shared-utils/equal';
3
- import Main from '../Components/Main';
3
+ import Main from '../Components/Main.svelte';
4
4
  import formatData from '../utils/formatData';
5
5
  import { CAMERA_IMAGE } from '../Assets/camera';
6
6
  import { omit } from '../../shared-utils/filter';
@@ -18,7 +18,7 @@ import { CAMERA_IMAGE } from '../../Assets/camera';
18
18
  import throttle from '../../../shared-utils/throttle';
19
19
 
20
20
  function add_css(target) {
21
- append_styles(target, "svelte-o7uo2v", ".plugin-radar__camera-wrapper.svelte-o7uo2v{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-o7uo2v{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-o7uo2v{position:absolute;left:-15px;top:-15px;width:17px;height:17px;transform-origin:15px 15px;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}");
21
+ append_styles(target, "svelte-1ty3s4p", ".plugin-radar__camera-wrapper.svelte-1ty3s4p{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1ty3s4p{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1ty3s4p{position:absolute;left:-0.78125rem;top:-0.78125rem;width:0.88542rem;height:0.88542rem;transform-origin:0.78125rem 0.78125rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}");
22
22
  }
23
23
 
24
24
  function create_fragment(ctx) {
@@ -31,12 +31,12 @@ function create_fragment(ctx) {
31
31
  div2 = element("div");
32
32
  div1 = element("div");
33
33
  div0 = element("div");
34
- attr(div0, "class", "plugin-radar__camera-rotate svelte-o7uo2v");
34
+ attr(div0, "class", "plugin-radar__camera-rotate svelte-1ty3s4p");
35
35
  set_style(div0, "background-image", "url(" + (/*cameraImageUrl*/ ctx[0] || CAMERA_IMAGE) + ")");
36
36
  set_style(div0, "transform", /*rotateTransform*/ ctx[1], false);
37
- attr(div1, "class", "plugin-radar__camera-position svelte-o7uo2v");
37
+ attr(div1, "class", "plugin-radar__camera-position svelte-1ty3s4p");
38
38
  set_style(div1, "transform", /*positionTransform*/ ctx[2], false);
39
- attr(div2, "class", "plugin-radar__camera-wrapper svelte-o7uo2v");
39
+ attr(div2, "class", "plugin-radar__camera-wrapper svelte-1ty3s4p");
40
40
  },
41
41
  m(target, anchor) {
42
42
  insert(target, div2, anchor);
@@ -0,0 +1,85 @@
1
+ <script>import { onMount } from 'svelte';
2
+ import { CAMERA_IMAGE } from '../../Assets/camera';
3
+ import throttle from '../../../shared-utils/throttle';
4
+ export let five;
5
+ export let pxmm;
6
+ export let floorplanData;
7
+ export let cameraImageUrl;
8
+ let panoIndex = five.getCurrentState().panoIndex;
9
+ let longitude = five.getCurrentState().longitude;
10
+ // 初始状态,不能等 mount 之后再计算,那样第一次 camera 展示的时候也会有动画
11
+ $: positionTransform = getCameraPositionTransform(floorplanData, panoIndex);
12
+ $: rotateTransform = getCameraRotateTransform(longitude);
13
+ /** 获取相机在当前 Five 状态下的位移 */
14
+ function getCameraPositionTransform(floorplanData, panoIndex) {
15
+ const bounding = floorplanData.bounding;
16
+ const floorplanObserver = floorplanData.observers[panoIndex];
17
+ if (!floorplanObserver)
18
+ return '';
19
+ const clientWidth = (bounding.max.x - bounding.min.x) * pxmm;
20
+ const clientHeight = (bounding.max.y - bounding.min.y) * pxmm;
21
+ const left = Math.floor(floorplanObserver.positionInImage.x * clientWidth);
22
+ const top = Math.floor(floorplanObserver.positionInImage.y * clientHeight);
23
+ return `translate(${left}px, ${top}px)`;
24
+ }
25
+ /** 获取相机在当前 Five 状态下的旋转 */
26
+ function getCameraRotateTransform(longitude) {
27
+ // 为什么要加 45 ==> 因为 UI 给的图初始角度是 -45
28
+ const rotate = Math.floor((longitude / Math.PI) * 180) * -1 + 45;
29
+ return `rotate(${rotate}deg)`;
30
+ }
31
+ function onFivePanoWillArrive(_panoIndex) {
32
+ panoIndex = _panoIndex;
33
+ }
34
+ const onFiveCameraDirectionUpdate = throttle((pose) => {
35
+ longitude = pose.longitude;
36
+ }, 1000 / 60);
37
+ onMount(() => {
38
+ five.on('panoWillArrive', onFivePanoWillArrive);
39
+ five.on('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
40
+ return function dispose() {
41
+ five.off('panoWillArrive', onFivePanoWillArrive);
42
+ five.off('cameraDirectionUpdate', onFiveCameraDirectionUpdate);
43
+ };
44
+ });
45
+ </script>
46
+
47
+ <div class="plugin-radar__camera-wrapper">
48
+ <div class="plugin-radar__camera-position" style:transform={positionTransform}>
49
+ <div
50
+ class="plugin-radar__camera-rotate"
51
+ style:transform={rotateTransform}
52
+ style="background-image: url({cameraImageUrl || CAMERA_IMAGE})"
53
+ />
54
+ </div>
55
+ </div>
56
+
57
+ <style>
58
+ .plugin-radar__camera-wrapper {
59
+ width: 100%;
60
+ height: 100%;
61
+ position: absolute;
62
+ pointer-events: none;
63
+ }
64
+ .plugin-radar__camera-position {
65
+ position: absolute;
66
+ left: 0;
67
+ top: 0;
68
+ width: 0;
69
+ height: 0;
70
+ transform: none;
71
+ pointer-events: none;
72
+ transition: transform 1s linear;
73
+ }
74
+ .plugin-radar__camera-rotate {
75
+ position: absolute;
76
+ left: -15px;
77
+ top: -15px;
78
+ width: 17px;
79
+ height: 17px;
80
+ transform-origin: 15px 15px;
81
+ transform: rotate(45deg);
82
+ background-repeat: no-repeat;
83
+ background-size: 100%;
84
+ }
85
+ </style>
@@ -0,0 +1,18 @@
1
+ <script>import ExtraObjects from './ExtraObjects.svelte';
2
+ import BaseImage from '../../../Components/BaseImage.svelte';
3
+ import Highlight from '../../../Components/RoomHighlight/RoomHighlight.svelte';
4
+ export let five;
5
+ export let pxmm;
6
+ export let floorIndex;
7
+ export let hoverEnable;
8
+ export let floorplanData;
9
+ export let extraObjects = [];
10
+ $: currentFloorExtraObjects = extraObjects === null || extraObjects === void 0 ? void 0 : extraObjects.filter((object) => object.floorIndex === floorIndex);
11
+ const onRoomHeightClick = undefined;
12
+ </script>
13
+
14
+ <BaseImage {...{ floorIndex, floorplanData }} />
15
+ <ExtraObjects extraObjects={currentFloorExtraObjects} />
16
+ {#if hoverEnable}
17
+ <Highlight {...{ five, pxmm, floorIndex, floorplanData, onRoomHeightClick }} />
18
+ {/if}
@@ -17,7 +17,7 @@ import {
17
17
  } from "svelte/internal";
18
18
 
19
19
  function add_css(target) {
20
- append_styles(target, "svelte-8n0d4v", ".plugin-pano-floorplan__extra-objects.svelte-8n0d4v{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-8n0d4v{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-8n0d4v{transform:translate(-50%, -50%)}");
20
+ append_styles(target, "svelte-1i87fz7", ".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}");
21
21
  }
22
22
 
23
23
  function get_each_context(ctx, list, i) {
@@ -43,11 +43,11 @@ function create_each_block(key_1, ctx) {
43
43
  div1 = element("div");
44
44
  div0 = element("div");
45
45
  t = space();
46
- attr(div0, "class", "plugin-pano-floorplan__extra-object-item svelte-8n0d4v");
46
+ attr(div0, "class", "plugin-pano-floorplan__extra-object-item svelte-1i87fz7");
47
47
  set_style(div0, "background-image", `url(${/*extraObject*/ ctx[1].icon.url})`);
48
48
  set_style(div0, "width", style_width, false);
49
49
  set_style(div0, "height", style_height, false);
50
- attr(div1, "class", "plugin-pano-floorplan__extra-object-item--position svelte-8n0d4v");
50
+ attr(div1, "class", "plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7");
51
51
  set_style(div1, "top", style_top, false);
52
52
  set_style(div1, "left", style_left, false);
53
53
  this.first = div1;
@@ -107,7 +107,7 @@ function create_fragment(ctx) {
107
107
  each_blocks[i].c();
108
108
  }
109
109
 
110
- attr(div, "class", "plugin-pano-floorplan__extra-objects svelte-8n0d4v");
110
+ attr(div, "class", "plugin-pano-floorplan__extra-objects svelte-1i87fz7");
111
111
  },
112
112
  m(target, anchor) {
113
113
  insert(target, div, anchor);
@@ -0,0 +1,40 @@
1
+ <script>export let extraObjects = [];
2
+ </script>
3
+
4
+ <div class="plugin-pano-floorplan__extra-objects">
5
+ {#each extraObjects as extraObject (extraObject.id)}
6
+ <div
7
+ class="plugin-pano-floorplan__extra-object-item--position"
8
+ style:top="{extraObject.positionInImage.y * 100}%"
9
+ style:left="{extraObject.positionInImage.x * 100}%"
10
+ >
11
+ <div
12
+ class="plugin-pano-floorplan__extra-object-item"
13
+ style:width="{extraObject.icon.width / 16}rem"
14
+ style:height="{extraObject.icon.height / 16}rem"
15
+ style="background-image: {`url(${extraObject.icon.url})`}"
16
+ />
17
+ </div>
18
+ {/each}
19
+ </div>
20
+
21
+ <style>
22
+ .plugin-pano-floorplan__extra-objects {
23
+ position: absolute;
24
+ top: 0;
25
+ left: 0;
26
+ width: 100%;
27
+ height: 100%;
28
+ pointer-events: none;
29
+ }
30
+
31
+ .plugin-pano-floorplan__extra-object-item--position {
32
+ position: absolute;
33
+ width: 0;
34
+ height: 0;
35
+ }
36
+
37
+ .plugin-pano-floorplan__extra-object-item {
38
+ transform: translate(-50%, -50%);
39
+ }
40
+ </style>
@@ -30,7 +30,7 @@ import Camera from './Camera';
30
30
  import CurrentFloor from './CurrentFloor/CurrentFloor';
31
31
 
32
32
  function add_css(target) {
33
- append_styles(target, "svelte-7d8ub2", ".plugin-floorplan-radar.svelte-7d8ub2{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-7d8ub2{position:relative}");
33
+ append_styles(target, "svelte-1mvqyqq", ".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}");
34
34
  }
35
35
 
36
36
  // (41:0) {#if visible}
@@ -44,7 +44,7 @@ function create_if_block(ctx) {
44
44
  c() {
45
45
  div = element("div");
46
46
  if (if_block) if_block.c();
47
- attr(div, "class", "plugin-floorplan-radar svelte-7d8ub2");
47
+ attr(div, "class", "plugin-floorplan-radar svelte-1mvqyqq");
48
48
  add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
49
49
  },
50
50
  m(target, anchor) {
@@ -146,7 +146,7 @@ function create_if_block_1(ctx) {
146
146
  create_component(currentfloor.$$.fragment);
147
147
  t = space();
148
148
  create_component(camera.$$.fragment);
149
- attr(div, "class", "plugin-floorplan-radar-container svelte-7d8ub2");
149
+ attr(div, "class", "plugin-floorplan-radar-container svelte-1mvqyqq");
150
150
  set_style(div, "width", style_width, false);
151
151
  set_style(div, "height", style_height, false);
152
152
  },
@@ -0,0 +1,64 @@
1
+ <script>import { onMount } from 'svelte';
2
+ import Camera from './Camera.svelte';
3
+ import CurrentFloor from './CurrentFloor/CurrentFloor.svelte';
4
+ export let five;
5
+ export let visible;
6
+ export let hoverEnable;
7
+ export let floorplanData;
8
+ export let cameraImageUrl;
9
+ export let extraObjects = [];
10
+ let pxmm = 0;
11
+ let floorIndex = 0;
12
+ let clientWidth = 0;
13
+ let clientHeight = 0;
14
+ let contentWidth = 0;
15
+ let contentHeight = 0;
16
+ $: {
17
+ const size = Math.min(clientWidth, clientHeight);
18
+ const { max, min } = floorplanData.bounding;
19
+ const boundingWidth = max.x - min.x;
20
+ const boundingHeight = max.y - min.y;
21
+ const contentSize = (function getSize() {
22
+ if (boundingWidth > boundingHeight)
23
+ return [size, (size / boundingWidth) * boundingHeight];
24
+ return [(size / boundingHeight) * boundingWidth, size];
25
+ })();
26
+ contentWidth = contentSize[0];
27
+ contentHeight = contentSize[1];
28
+ pxmm = contentWidth / boundingWidth;
29
+ }
30
+ function handlePanoArrived(panoIndex) {
31
+ floorIndex = five.work.observers[panoIndex].floorIndex;
32
+ }
33
+ onMount(() => {
34
+ five.on('panoArrived', handlePanoArrived);
35
+ return () => {
36
+ five.off('panoArrived', handlePanoArrived);
37
+ };
38
+ });
39
+ </script>
40
+
41
+ {#if visible}
42
+ <div class="plugin-floorplan-radar" bind:clientWidth bind:clientHeight>
43
+ {#if clientWidth !== 0}
44
+ <div class="plugin-floorplan-radar-container" style:width="{contentWidth}px" style:height="{contentHeight}px">
45
+ <CurrentFloor {...{ five, pxmm, floorIndex, floorplanData, hoverEnable, extraObjects }} />
46
+ <Camera {...{ pxmm, five, floorplanData, cameraImageUrl }} />
47
+ </div>
48
+ {/if}
49
+ </div>
50
+ {/if}
51
+
52
+ <style>
53
+ .plugin-floorplan-radar {
54
+ width: 100%;
55
+ height: 100%;
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+ }
60
+
61
+ .plugin-floorplan-radar-container {
62
+ position: relative;
63
+ }
64
+ </style>
@@ -1,4 +1,4 @@
1
- import Main from './Components/Main';
1
+ import Main from './Components/Main.svelte';
2
2
  import equal from '../../shared-utils/equal';
3
3
  import { CAMERA_IMAGE } from '../Assets/camera';
4
4
  import * as BasePlugin from '../../base/BasePluginWithData';
@@ -1,6 +1,6 @@
1
1
  import * as THREE from 'three';
2
2
  import equal from '../../shared-utils/equal';
3
- import Main from '../Components/Main';
3
+ import Main from '../Components/Main.svelte';
4
4
  import formatData from '../utils/formatData';
5
5
  import { CAMERA_IMAGE } from '../Assets/camera';
6
6
  import { omit } from '../../shared-utils/filter';
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "repository": "https://github.com/realsee-developer/dnalogel.git",
9
9
  "description": "如视 VR 看房插件合集",
10
10
  "private": false,
11
- "version": "2.0.0-alpha.43",
11
+ "version": "2.0.0-alpha.44",
12
12
  "license": "SEE LICENSE IN TERMS.txt",
13
13
  "files": [
14
14
  "libs",
@@ -40,6 +40,7 @@
40
40
  "rollup-plugin-multi-input": "^1.3.1",
41
41
  "rollup-plugin-postcss": "^4.0.2",
42
42
  "rollup-plugin-svelte": "^7.1.0",
43
+ "sass": "^1.54.5",
43
44
  "svelte-check": "^2.2.7",
44
45
  "svelte-preprocess": "^4.10.6",
45
46
  "svelte-strip": "^1.0.1",