@realsee/dnalogel 2.0.0-alpha.36 → 2.0.0-alpha.39
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/dist/ItemLabelPlugin/index.js +60 -36
- package/dist/ItemLabelPlugin/typings.d.ts +4 -0
- package/dist/ModelViewPlugin/Plugin.d.ts +4 -4
- package/dist/ModelViewPlugin/index.js +2 -3
- package/dist/PanoRulerProPlugin/Controller.d.ts +15 -0
- package/dist/PanoRulerProPlugin/index.d.ts +8 -0
- package/dist/PanoRulerProPlugin/index.js +1006 -0
- package/dist/PanoRulerProPlugin/typings.d.ts +46 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -1
- package/dist/floorplan/ModelFloorplanPlugin/index.js +8 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +1036 -243
- package/dist/index.js +1037 -242
- package/dist/index.umd.js +1037 -242
- package/dist/shared-utils/logger.d.ts +16 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- 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/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- 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 +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- 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 +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- 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/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 +2 -2
- 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/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -0
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -0
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -0
- package/docs/interfaces/PanoRulerProPluginState.html +1 -0
- 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/modules.html +19 -17
- package/libs/ItemLabelPlugin/ItemLabelComponent.js +34 -21
- package/libs/ItemLabelPlugin/Plugin.js +16 -10
- package/libs/ItemLabelPlugin/typings.d.ts +4 -0
- package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
- package/libs/ModelViewPlugin/Plugin.d.ts +4 -4
- package/libs/ModelViewPlugin/Plugin.js +2 -3
- package/libs/PanoRulerProPlugin/Controller.d.ts +15 -0
- package/libs/PanoRulerProPlugin/Controller.js +110 -0
- package/libs/PanoRulerProPlugin/RulerItem.js +314 -0
- package/libs/PanoRulerProPlugin/RulerItems.js +377 -0
- package/libs/PanoRulerProPlugin/index.d.ts +8 -0
- package/libs/PanoRulerProPlugin/index.js +8 -0
- package/libs/PanoRulerProPlugin/typings.d.ts +46 -0
- package/libs/PanoRulerProPlugin/typings.js +1 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +8 -1
- package/libs/index.d.ts +2 -0
- package/libs/index.js +3 -0
- package/libs/shared-utils/logger.d.ts +16 -0
- package/libs/shared-utils/logger.js +47 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var internal = require('svelte/internal');
|
|
6
|
+
var five = require('@realsee/five');
|
|
7
|
+
var svelte = require('svelte');
|
|
8
|
+
var three = require('three');
|
|
9
|
+
|
|
10
|
+
const _requestAnimationFrame = window.requestAnimationFrame || ((fn) => setTimeout(fn, 16));
|
|
11
|
+
function nextFrame(fn, delay = 0) {
|
|
12
|
+
if (delay <= 0)
|
|
13
|
+
_requestAnimationFrame(fn);
|
|
14
|
+
else
|
|
15
|
+
_requestAnimationFrame(() => nextFrame(fn, delay - 1));
|
|
16
|
+
}
|
|
17
|
+
// export { Easing } from './tween'
|
|
18
|
+
// export { default as tween } from './tween'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 检查一个值是否是狭义上的对象
|
|
22
|
+
* @param {any} value 要检查的值
|
|
23
|
+
*
|
|
24
|
+
* isTruelyObject({})
|
|
25
|
+
* // => true
|
|
26
|
+
*
|
|
27
|
+
* isObjectLike([1, 2, 3])
|
|
28
|
+
* // => false
|
|
29
|
+
*
|
|
30
|
+
* isObjectLike(Function)
|
|
31
|
+
* // => false
|
|
32
|
+
*
|
|
33
|
+
* isObjectLike(null)
|
|
34
|
+
* // => false
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
function isTruelyObject(value) {
|
|
38
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
42
|
+
function baseIsEqual(value, other) {
|
|
43
|
+
if (value === other)
|
|
44
|
+
return true;
|
|
45
|
+
if (typeof value !== typeof other)
|
|
46
|
+
return false;
|
|
47
|
+
if (Number.isNaN(value) && Number.isNaN(other))
|
|
48
|
+
return true;
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
function objEqualShallow(value, other) {
|
|
52
|
+
const valueProps = Object.getOwnPropertyNames(value);
|
|
53
|
+
const otherProps = Object.getOwnPropertyNames(other);
|
|
54
|
+
if (valueProps.length !== otherProps.length)
|
|
55
|
+
return false;
|
|
56
|
+
for (let i = 0, len = valueProps.length; i < len; i++) {
|
|
57
|
+
const propName = valueProps[i];
|
|
58
|
+
if (!baseIsEqual(value[propName], other[propName]))
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
function arrayEqualShallow(value, other) {
|
|
64
|
+
if (value.length !== other.length)
|
|
65
|
+
return false;
|
|
66
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
67
|
+
if (!baseIsEqual(value[i], other[i]))
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
function isShallowEqual(value, other) {
|
|
73
|
+
if (baseIsEqual(value, other))
|
|
74
|
+
return true;
|
|
75
|
+
if (isTruelyObject(value) && isTruelyObject(other))
|
|
76
|
+
return objEqualShallow(value, other);
|
|
77
|
+
if (Array.isArray(value) && Array.isArray(other))
|
|
78
|
+
return arrayEqualShallow(value, other);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
function isDeepEqual(value, other) {
|
|
82
|
+
if (baseIsEqual(value, other))
|
|
83
|
+
return true;
|
|
84
|
+
if (isTruelyObject(value) && isTruelyObject(other))
|
|
85
|
+
return objEqualDeep(value, other);
|
|
86
|
+
if (Array.isArray(value) && Array.isArray(other))
|
|
87
|
+
return arrayEqualDeep(value, other);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
function arrayEqualDeep(value, other) {
|
|
91
|
+
if (value.length !== other.length)
|
|
92
|
+
return false;
|
|
93
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
94
|
+
if (!isDeepEqual(value[i], other[i]))
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
function objEqualDeep(value, other) {
|
|
100
|
+
const valueProps = Object.getOwnPropertyNames(value);
|
|
101
|
+
const otherProps = Object.getOwnPropertyNames(other);
|
|
102
|
+
if (valueProps.length !== otherProps.length)
|
|
103
|
+
return false;
|
|
104
|
+
for (let i = 0, len = valueProps.length; i < len; i++) {
|
|
105
|
+
const propName = valueProps[i];
|
|
106
|
+
if (!isDeepEqual(value[propName], other[propName]))
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 对象比较
|
|
113
|
+
* @param {*} value 第一个比较的值
|
|
114
|
+
* @param {*} other 第二个比较的值
|
|
115
|
+
* @param {Object} options 可选参数,可选项包括:<br />
|
|
116
|
+
* deep {Boolean} 是否深比较<br />
|
|
117
|
+
* @returns {boolean} 是否相等
|
|
118
|
+
*/
|
|
119
|
+
function equal(value, other, opt = { deep: false }) {
|
|
120
|
+
if (!opt.deep)
|
|
121
|
+
return isShallowEqual(value, other);
|
|
122
|
+
return isDeepEqual(value, other);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 平面几何相关数学函数
|
|
127
|
+
*/
|
|
128
|
+
/**
|
|
129
|
+
* 检查两个点是否位置相同
|
|
130
|
+
* @param point1
|
|
131
|
+
* @param point2
|
|
132
|
+
* @return
|
|
133
|
+
*/
|
|
134
|
+
function samePointAt(point1, point2) {
|
|
135
|
+
return point1.x === point2.x && point1.y === point2.y;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 两个计算的斜率是否相同
|
|
139
|
+
* @param {number} k1
|
|
140
|
+
* @param {number} k2
|
|
141
|
+
* @return
|
|
142
|
+
*/
|
|
143
|
+
function sameK(k1, k2) {
|
|
144
|
+
if (Math.abs(k1) === Infinity && Math.abs(k2) === Infinity)
|
|
145
|
+
return true;
|
|
146
|
+
return Math.abs(k1 - k2) < 0.001;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 获取两点之间的斜率
|
|
150
|
+
* @param {point} point1
|
|
151
|
+
* @param {point} point2
|
|
152
|
+
* @return {number}
|
|
153
|
+
*/
|
|
154
|
+
function getK(point1, point2) {
|
|
155
|
+
return (point2.y - point1.y) / (point2.x - point1.x);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 两条线段(包括延长线)的交点点
|
|
159
|
+
* @param {linePoints} linePoints1
|
|
160
|
+
* @param {linePoints} linePoints2
|
|
161
|
+
* @param needIntersectionInLine 是否是延长线的相交
|
|
162
|
+
* @return {point || false}
|
|
163
|
+
*/
|
|
164
|
+
function intersectionOfLine(linePoints1, linePoints2, needIntersectionInLine) {
|
|
165
|
+
const k1 = getK(linePoints1[1], linePoints1[0]);
|
|
166
|
+
const k2 = getK(linePoints2[1], linePoints2[0]);
|
|
167
|
+
if (isNaN(k1) || isNaN(k2))
|
|
168
|
+
return false;
|
|
169
|
+
if (sameK(k1, k2))
|
|
170
|
+
return false;
|
|
171
|
+
if (pointOnLine(linePoints1[0], linePoints2))
|
|
172
|
+
return linePoints1[0];
|
|
173
|
+
if (pointOnLine(linePoints1[1], linePoints2))
|
|
174
|
+
return linePoints1[1];
|
|
175
|
+
if (pointOnLine(linePoints2[0], linePoints1))
|
|
176
|
+
return linePoints2[0];
|
|
177
|
+
if (pointOnLine(linePoints2[1], linePoints1))
|
|
178
|
+
return linePoints2[1];
|
|
179
|
+
//needIntersectionInLine 是否焦点在线段内
|
|
180
|
+
if (needIntersectionInLine && !isIntersect(linePoints1, linePoints2))
|
|
181
|
+
return false;
|
|
182
|
+
const p1 = linePoints1[0];
|
|
183
|
+
const p2 = linePoints2[0];
|
|
184
|
+
if (Math.abs(k1) === Infinity) {
|
|
185
|
+
return { x: p1.x, y: linePoints2[1].y - (linePoints2[1].x - p1.x) * k2 };
|
|
186
|
+
}
|
|
187
|
+
if (Math.abs(k2) === Infinity) {
|
|
188
|
+
return { x: p2.x, y: linePoints1[1].y - (linePoints1[1].x - p2.x) * k1 };
|
|
189
|
+
}
|
|
190
|
+
const x = (p2.y - p1.y + k1 * p1.x - k2 * p2.x) / (k1 - k2);
|
|
191
|
+
const y = k1 * x - k1 * p1.x + p1.y;
|
|
192
|
+
return { x, y };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 是否点在线段上
|
|
196
|
+
* @param {point} point
|
|
197
|
+
* @param {linePoints} linePoints
|
|
198
|
+
* @return
|
|
199
|
+
*/
|
|
200
|
+
function pointOnLine(point, linePoints) {
|
|
201
|
+
if (samePointAt(point, linePoints[0]))
|
|
202
|
+
return true;
|
|
203
|
+
if (samePointAt(point, linePoints[1]))
|
|
204
|
+
return true;
|
|
205
|
+
return ((linePoints[0].x - point.x) * (point.x - linePoints[1].x) >= 0 &&
|
|
206
|
+
(linePoints[0].y - point.y) * (point.y - linePoints[1].y) >= 0 &&
|
|
207
|
+
sameK(getK(linePoints[0], point), getK(point, linePoints[1])));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 判断两条线段是否相交
|
|
211
|
+
*/
|
|
212
|
+
function multi(p1, p2, p0) {
|
|
213
|
+
return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
|
|
214
|
+
}
|
|
215
|
+
function isIntersect(linePoints1, linePoints2) {
|
|
216
|
+
if (Math.max(linePoints1[0].x, linePoints1[1].x) >= Math.min(linePoints2[0].x, linePoints2[1].x) &&
|
|
217
|
+
Math.max(linePoints2[0].x, linePoints2[1].x) >= Math.min(linePoints1[0].x, linePoints1[1].x) &&
|
|
218
|
+
Math.max(linePoints1[0].y, linePoints1[1].y) >= Math.min(linePoints2[0].y, linePoints2[1].y) &&
|
|
219
|
+
multi(linePoints2[0], linePoints1[1], linePoints1[0]) * multi(linePoints1[1], linePoints2[1], linePoints1[0]) > 0 &&
|
|
220
|
+
multi(linePoints1[0], linePoints2[1], linePoints2[0]) * multi(linePoints2[1], linePoints1[1], linePoints2[0]) > 0)
|
|
221
|
+
return 1;
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 创建一个防抖动函数,该函数在高频调用时会每隔 wait 毫秒后调用 func 方法
|
|
227
|
+
* `throttle` 会在第一次调用时立刻调用一次
|
|
228
|
+
* @param func - 要防抖动的函数
|
|
229
|
+
* @param wait - 需要延迟的毫秒数
|
|
230
|
+
*/
|
|
231
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
232
|
+
function throttle(func, wait = 200) {
|
|
233
|
+
let last;
|
|
234
|
+
return function (...args) {
|
|
235
|
+
if (last)
|
|
236
|
+
return;
|
|
237
|
+
func(...args);
|
|
238
|
+
last = setTimeout(function () {
|
|
239
|
+
last = null;
|
|
240
|
+
}, wait);
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* src/PanoRulerProPlugin/RulerItem.svelte generated by Svelte v3.47.0 */
|
|
245
|
+
|
|
246
|
+
function add_css(target) {
|
|
247
|
+
internal.append_styles(target, "svelte-qy4ud2", ".PanoRulerPlugin-rule-line.svelte-qy4ud2.svelte-qy4ud2{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-qy4ud2.svelte-qy4ud2::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;-webkit-animation:svelte-qy4ud2-viewport-rule-point 0.1s 1s;animation:svelte-qy4ud2-viewport-rule-point 0.1s 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-qy4ud2.svelte-qy4ud2::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;-webkit-animation:svelte-qy4ud2-viewport-rule-point 0.1s 1.5s;animation:svelte-qy4ud2-viewport-rule-point 0.1s 1.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-qy4ud2 em.svelte-qy4ud2{display:block;height:0.0625rem;-webkit-animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-qy4ud2.svelte-qy4ud2{display:flex;height:0.0625rem;-webkit-animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;animation:svelte-qy4ud2-viewport-rule-line 0.5s ease 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;align-items:center}.em-solid.svelte-qy4ud2.svelte-qy4ud2{height:100%;background:#ffffff}.em-dotted.svelte-qy4ud2.svelte-qy4ud2{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-qy4ud2.svelte-qy4ud2{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-qy4ud2.svelte-qy4ud2{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;-webkit-animation:svelte-qy4ud2-viewport-rule-label 0.25s ease 1s;animation:svelte-qy4ud2-viewport-rule-label 0.25s ease 1s;-webkit-animation-fill-mode:both;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@-webkit-keyframes svelte-qy4ud2-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-qy4ud2-viewport-rule-line{0%{width:0%}100%{width:100%}}@-webkit-keyframes svelte-qy4ud2-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-qy4ud2-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@-webkit-keyframes svelte-qy4ud2-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}@keyframes svelte-qy4ud2-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}");
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function get_each_context$1(ctx, list, i) {
|
|
251
|
+
const child_ctx = ctx.slice();
|
|
252
|
+
child_ctx[6] = list[i];
|
|
253
|
+
return child_ctx;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// (28:2) {:else}
|
|
257
|
+
function create_else_block(ctx) {
|
|
258
|
+
let div;
|
|
259
|
+
let each_value = /*rulerItemProp*/ ctx[0].children;
|
|
260
|
+
let each_blocks = [];
|
|
261
|
+
|
|
262
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
263
|
+
each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return {
|
|
267
|
+
c() {
|
|
268
|
+
div = internal.element("div");
|
|
269
|
+
|
|
270
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
271
|
+
each_blocks[i].c();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
internal.attr(div, "class", "rule-mixed-line svelte-qy4ud2");
|
|
275
|
+
},
|
|
276
|
+
m(target, anchor) {
|
|
277
|
+
internal.insert(target, div, anchor);
|
|
278
|
+
|
|
279
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
280
|
+
each_blocks[i].m(div, null);
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
p(ctx, dirty) {
|
|
284
|
+
if (dirty & /*rulerItemProp, vars*/ 9) {
|
|
285
|
+
each_value = /*rulerItemProp*/ ctx[0].children;
|
|
286
|
+
let i;
|
|
287
|
+
|
|
288
|
+
for (i = 0; i < each_value.length; i += 1) {
|
|
289
|
+
const child_ctx = get_each_context$1(ctx, each_value, i);
|
|
290
|
+
|
|
291
|
+
if (each_blocks[i]) {
|
|
292
|
+
each_blocks[i].p(child_ctx, dirty);
|
|
293
|
+
} else {
|
|
294
|
+
each_blocks[i] = create_each_block$1(child_ctx);
|
|
295
|
+
each_blocks[i].c();
|
|
296
|
+
each_blocks[i].m(div, null);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
for (; i < each_blocks.length; i += 1) {
|
|
301
|
+
each_blocks[i].d(1);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
each_blocks.length = each_value.length;
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
d(detaching) {
|
|
308
|
+
if (detaching) internal.detach(div);
|
|
309
|
+
internal.destroy_each(each_blocks, detaching);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// (26:2) {#if rulerItemProp.children.length === 0}
|
|
315
|
+
function create_if_block(ctx) {
|
|
316
|
+
let em;
|
|
317
|
+
let em_class_value;
|
|
318
|
+
|
|
319
|
+
return {
|
|
320
|
+
c() {
|
|
321
|
+
em = internal.element("em");
|
|
322
|
+
|
|
323
|
+
internal.attr(em, "class", em_class_value = "" + (internal.null_to_empty(/*rulerItemProp*/ ctx[0].state
|
|
324
|
+
? 'em-solid'
|
|
325
|
+
: 'em-dotted') + " svelte-qy4ud2"));
|
|
326
|
+
|
|
327
|
+
internal.attr(em, "style", /*vars*/ ctx[3]);
|
|
328
|
+
},
|
|
329
|
+
m(target, anchor) {
|
|
330
|
+
internal.insert(target, em, anchor);
|
|
331
|
+
},
|
|
332
|
+
p(ctx, dirty) {
|
|
333
|
+
if (dirty & /*rulerItemProp*/ 1 && em_class_value !== (em_class_value = "" + (internal.null_to_empty(/*rulerItemProp*/ ctx[0].state
|
|
334
|
+
? 'em-solid'
|
|
335
|
+
: 'em-dotted') + " svelte-qy4ud2"))) {
|
|
336
|
+
internal.attr(em, "class", em_class_value);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (dirty & /*vars*/ 8) {
|
|
340
|
+
internal.attr(em, "style", /*vars*/ ctx[3]);
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
d(detaching) {
|
|
344
|
+
if (detaching) internal.detach(em);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// (30:6) {#each rulerItemProp.children as child}
|
|
350
|
+
function create_each_block$1(ctx) {
|
|
351
|
+
let div;
|
|
352
|
+
let div_class_value;
|
|
353
|
+
let style_width = `${/*child*/ ctx[6].width}px`;
|
|
354
|
+
|
|
355
|
+
return {
|
|
356
|
+
c() {
|
|
357
|
+
div = internal.element("div");
|
|
358
|
+
internal.attr(div, "class", div_class_value = "" + (internal.null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-qy4ud2"));
|
|
359
|
+
internal.attr(div, "style", /*vars*/ ctx[3]);
|
|
360
|
+
internal.set_style(div, "width", style_width, false);
|
|
361
|
+
},
|
|
362
|
+
m(target, anchor) {
|
|
363
|
+
internal.insert(target, div, anchor);
|
|
364
|
+
},
|
|
365
|
+
p(ctx, dirty) {
|
|
366
|
+
if (dirty & /*rulerItemProp*/ 1 && div_class_value !== (div_class_value = "" + (internal.null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-qy4ud2"))) {
|
|
367
|
+
internal.attr(div, "class", div_class_value);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (dirty & /*vars*/ 8) {
|
|
371
|
+
internal.attr(div, "style", /*vars*/ ctx[3]);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (dirty & /*rulerItemProp*/ 1 && style_width !== (style_width = `${/*child*/ ctx[6].width}px`)) {
|
|
375
|
+
internal.set_style(div, "width", style_width, false);
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
d(detaching) {
|
|
379
|
+
if (detaching) internal.detach(div);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function create_fragment$1(ctx) {
|
|
385
|
+
let div2;
|
|
386
|
+
let t0;
|
|
387
|
+
let div1;
|
|
388
|
+
let div0;
|
|
389
|
+
let t1_value = /*rulerItemProp*/ ctx[0].labelElement + "";
|
|
390
|
+
let t1;
|
|
391
|
+
let div0_resize_listener;
|
|
392
|
+
let style_left = `${/*rulerItemProp*/ ctx[0].labelOffset}%`;
|
|
393
|
+
let style_width = `${/*rulerItemProp*/ ctx[0].width}px`;
|
|
394
|
+
let style_left_1 = `${/*rulerItemProp*/ ctx[0].left}px`;
|
|
395
|
+
let style_top = `${/*rulerItemProp*/ ctx[0].top}px`;
|
|
396
|
+
let style_transform = `rotate(${/*rulerItemProp*/ ctx[0].rotateDeg}deg)`;
|
|
397
|
+
|
|
398
|
+
function select_block_type(ctx, dirty) {
|
|
399
|
+
if (/*rulerItemProp*/ ctx[0].children.length === 0) return create_if_block;
|
|
400
|
+
return create_else_block;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
let current_block_type = select_block_type(ctx);
|
|
404
|
+
let if_block = current_block_type(ctx);
|
|
405
|
+
|
|
406
|
+
return {
|
|
407
|
+
c() {
|
|
408
|
+
div2 = internal.element("div");
|
|
409
|
+
if_block.c();
|
|
410
|
+
t0 = internal.space();
|
|
411
|
+
div1 = internal.element("div");
|
|
412
|
+
div0 = internal.element("div");
|
|
413
|
+
t1 = internal.text(t1_value);
|
|
414
|
+
internal.attr(div0, "class", "PanoRulerPlugin-rule-label-name svelte-qy4ud2");
|
|
415
|
+
internal.add_render_callback(() => /*div0_elementresize_handler*/ ctx[4].call(div0));
|
|
416
|
+
internal.attr(div1, "class", "PanoRulerPlugin-rule-label svelte-qy4ud2");
|
|
417
|
+
internal.set_style(div1, "left", style_left, false);
|
|
418
|
+
internal.attr(div2, "class", "PanoRulerPlugin-rule-line svelte-qy4ud2");
|
|
419
|
+
internal.set_style(div2, "width", style_width, false);
|
|
420
|
+
internal.set_style(div2, "left", style_left_1, false);
|
|
421
|
+
internal.set_style(div2, "top", style_top, false);
|
|
422
|
+
internal.set_style(div2, "transform", style_transform, false);
|
|
423
|
+
|
|
424
|
+
internal.set_style(
|
|
425
|
+
div2,
|
|
426
|
+
"display",
|
|
427
|
+
/*rulerItemProp*/ ctx[0].visible && /*_visible*/ ctx[2]
|
|
428
|
+
? 'block'
|
|
429
|
+
: 'none',
|
|
430
|
+
false
|
|
431
|
+
);
|
|
432
|
+
},
|
|
433
|
+
m(target, anchor) {
|
|
434
|
+
internal.insert(target, div2, anchor);
|
|
435
|
+
if_block.m(div2, null);
|
|
436
|
+
internal.append(div2, t0);
|
|
437
|
+
internal.append(div2, div1);
|
|
438
|
+
internal.append(div1, div0);
|
|
439
|
+
internal.append(div0, t1);
|
|
440
|
+
div0_resize_listener = internal.add_resize_listener(div0, /*div0_elementresize_handler*/ ctx[4].bind(div0));
|
|
441
|
+
},
|
|
442
|
+
p(ctx, [dirty]) {
|
|
443
|
+
if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
|
|
444
|
+
if_block.p(ctx, dirty);
|
|
445
|
+
} else {
|
|
446
|
+
if_block.d(1);
|
|
447
|
+
if_block = current_block_type(ctx);
|
|
448
|
+
|
|
449
|
+
if (if_block) {
|
|
450
|
+
if_block.c();
|
|
451
|
+
if_block.m(div2, t0);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (dirty & /*rulerItemProp*/ 1 && t1_value !== (t1_value = /*rulerItemProp*/ ctx[0].labelElement + "")) internal.set_data(t1, t1_value);
|
|
456
|
+
|
|
457
|
+
if (dirty & /*rulerItemProp*/ 1 && style_left !== (style_left = `${/*rulerItemProp*/ ctx[0].labelOffset}%`)) {
|
|
458
|
+
internal.set_style(div1, "left", style_left, false);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (dirty & /*rulerItemProp*/ 1 && style_width !== (style_width = `${/*rulerItemProp*/ ctx[0].width}px`)) {
|
|
462
|
+
internal.set_style(div2, "width", style_width, false);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (dirty & /*rulerItemProp*/ 1 && style_left_1 !== (style_left_1 = `${/*rulerItemProp*/ ctx[0].left}px`)) {
|
|
466
|
+
internal.set_style(div2, "left", style_left_1, false);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (dirty & /*rulerItemProp*/ 1 && style_top !== (style_top = `${/*rulerItemProp*/ ctx[0].top}px`)) {
|
|
470
|
+
internal.set_style(div2, "top", style_top, false);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (dirty & /*rulerItemProp*/ 1 && style_transform !== (style_transform = `rotate(${/*rulerItemProp*/ ctx[0].rotateDeg}deg)`)) {
|
|
474
|
+
internal.set_style(div2, "transform", style_transform, false);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (dirty & /*rulerItemProp, _visible*/ 5) {
|
|
478
|
+
internal.set_style(
|
|
479
|
+
div2,
|
|
480
|
+
"display",
|
|
481
|
+
/*rulerItemProp*/ ctx[0].visible && /*_visible*/ ctx[2]
|
|
482
|
+
? 'block'
|
|
483
|
+
: 'none',
|
|
484
|
+
false
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
i: internal.noop,
|
|
489
|
+
o: internal.noop,
|
|
490
|
+
d(detaching) {
|
|
491
|
+
if (detaching) internal.detach(div2);
|
|
492
|
+
if_block.d();
|
|
493
|
+
div0_resize_listener();
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function instance$1($$self, $$props, $$invalidate) {
|
|
499
|
+
let vars;
|
|
500
|
+
let { rulerItemProp } = $$props;
|
|
501
|
+
let _visible = true;
|
|
502
|
+
let labelWidth;
|
|
503
|
+
let EM_DOTTED_BG = `data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=`;
|
|
504
|
+
|
|
505
|
+
function div0_elementresize_handler() {
|
|
506
|
+
labelWidth = this.offsetWidth;
|
|
507
|
+
$$invalidate(1, labelWidth);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
$$self.$$set = $$props => {
|
|
511
|
+
if ('rulerItemProp' in $$props) $$invalidate(0, rulerItemProp = $$props.rulerItemProp);
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
$$self.$$.update = () => {
|
|
515
|
+
if ($$self.$$.dirty & /*labelWidth, rulerItemProp*/ 3) {
|
|
516
|
+
{
|
|
517
|
+
if (labelWidth >= rulerItemProp.width || labelWidth / 2 >= rulerItemProp.labelOffset / 100 * rulerItemProp.width || labelWidth / 2 >= (1 - rulerItemProp.labelOffset / 100) * rulerItemProp.width) {
|
|
518
|
+
$$invalidate(2, _visible = false);
|
|
519
|
+
} else {
|
|
520
|
+
$$invalidate(2, _visible = true);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
$$invalidate(3, vars = `--background-image: url(${EM_DOTTED_BG})`);
|
|
527
|
+
return [rulerItemProp, labelWidth, _visible, vars, div0_elementresize_handler];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
class RulerItem extends internal.SvelteComponent {
|
|
531
|
+
constructor(options) {
|
|
532
|
+
super();
|
|
533
|
+
internal.init(this, options, instance$1, create_fragment$1, internal.safe_not_equal, { rulerItemProp: 0 }, add_css);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/* src/PanoRulerProPlugin/RulerItems.svelte generated by Svelte v3.47.0 */
|
|
538
|
+
|
|
539
|
+
function get_each_context(ctx, list, i) {
|
|
540
|
+
const child_ctx = ctx.slice();
|
|
541
|
+
child_ctx[16] = list[i];
|
|
542
|
+
return child_ctx;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// (206:2) {#each rulerItemProp as itemData}
|
|
546
|
+
function create_each_block(ctx) {
|
|
547
|
+
let ruleritem;
|
|
548
|
+
let current;
|
|
549
|
+
|
|
550
|
+
ruleritem = new RulerItem({
|
|
551
|
+
props: { rulerItemProp: /*itemData*/ ctx[16] }
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
return {
|
|
555
|
+
c() {
|
|
556
|
+
internal.create_component(ruleritem.$$.fragment);
|
|
557
|
+
},
|
|
558
|
+
m(target, anchor) {
|
|
559
|
+
internal.mount_component(ruleritem, target, anchor);
|
|
560
|
+
current = true;
|
|
561
|
+
},
|
|
562
|
+
p(ctx, dirty) {
|
|
563
|
+
const ruleritem_changes = {};
|
|
564
|
+
if (dirty & /*rulerItemProp*/ 1) ruleritem_changes.rulerItemProp = /*itemData*/ ctx[16];
|
|
565
|
+
ruleritem.$set(ruleritem_changes);
|
|
566
|
+
},
|
|
567
|
+
i(local) {
|
|
568
|
+
if (current) return;
|
|
569
|
+
internal.transition_in(ruleritem.$$.fragment, local);
|
|
570
|
+
current = true;
|
|
571
|
+
},
|
|
572
|
+
o(local) {
|
|
573
|
+
internal.transition_out(ruleritem.$$.fragment, local);
|
|
574
|
+
current = false;
|
|
575
|
+
},
|
|
576
|
+
d(detaching) {
|
|
577
|
+
internal.destroy_component(ruleritem, detaching);
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
function create_fragment(ctx) {
|
|
583
|
+
let div;
|
|
584
|
+
let current;
|
|
585
|
+
let each_value = /*rulerItemProp*/ ctx[0];
|
|
586
|
+
let each_blocks = [];
|
|
587
|
+
|
|
588
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
589
|
+
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const out = i => internal.transition_out(each_blocks[i], 1, 1, () => {
|
|
593
|
+
each_blocks[i] = null;
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
return {
|
|
597
|
+
c() {
|
|
598
|
+
div = internal.element("div");
|
|
599
|
+
|
|
600
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
601
|
+
each_blocks[i].c();
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
m(target, anchor) {
|
|
605
|
+
internal.insert(target, div, anchor);
|
|
606
|
+
|
|
607
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
608
|
+
each_blocks[i].m(div, null);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
current = true;
|
|
612
|
+
},
|
|
613
|
+
p(ctx, [dirty]) {
|
|
614
|
+
if (dirty & /*rulerItemProp*/ 1) {
|
|
615
|
+
each_value = /*rulerItemProp*/ ctx[0];
|
|
616
|
+
let i;
|
|
617
|
+
|
|
618
|
+
for (i = 0; i < each_value.length; i += 1) {
|
|
619
|
+
const child_ctx = get_each_context(ctx, each_value, i);
|
|
620
|
+
|
|
621
|
+
if (each_blocks[i]) {
|
|
622
|
+
each_blocks[i].p(child_ctx, dirty);
|
|
623
|
+
internal.transition_in(each_blocks[i], 1);
|
|
624
|
+
} else {
|
|
625
|
+
each_blocks[i] = create_each_block(child_ctx);
|
|
626
|
+
each_blocks[i].c();
|
|
627
|
+
internal.transition_in(each_blocks[i], 1);
|
|
628
|
+
each_blocks[i].m(div, null);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
internal.group_outros();
|
|
633
|
+
|
|
634
|
+
for (i = each_value.length; i < each_blocks.length; i += 1) {
|
|
635
|
+
out(i);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
internal.check_outros();
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
i(local) {
|
|
642
|
+
if (current) return;
|
|
643
|
+
|
|
644
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
645
|
+
internal.transition_in(each_blocks[i]);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
current = true;
|
|
649
|
+
},
|
|
650
|
+
o(local) {
|
|
651
|
+
each_blocks = each_blocks.filter(Boolean);
|
|
652
|
+
|
|
653
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
654
|
+
internal.transition_out(each_blocks[i]);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
current = false;
|
|
658
|
+
},
|
|
659
|
+
d(detaching) {
|
|
660
|
+
if (detaching) internal.detach(div);
|
|
661
|
+
internal.destroy_each(each_blocks, detaching);
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function instance($$self, $$props, $$invalidate) {
|
|
667
|
+
var _a, _b, _c, _d;
|
|
668
|
+
let { five: five$1 } = $$props;
|
|
669
|
+
let { rulerDatas } = $$props;
|
|
670
|
+
let { options } = $$props;
|
|
671
|
+
let rulerItemProp = [];
|
|
672
|
+
|
|
673
|
+
const canvasWidth = ((_b = (_a = five$1.getElement()) === null || _a === void 0
|
|
674
|
+
? void 0
|
|
675
|
+
: _a.parentElement) === null || _b === void 0
|
|
676
|
+
? void 0
|
|
677
|
+
: _b.clientWidth) || 0;
|
|
678
|
+
|
|
679
|
+
const canvasHeight = ((_d = (_c = five$1.getElement()) === null || _c === void 0
|
|
680
|
+
? void 0
|
|
681
|
+
: _c.parentElement) === null || _d === void 0
|
|
682
|
+
? void 0
|
|
683
|
+
: _d.clientHeight) || 0;
|
|
684
|
+
|
|
685
|
+
const getRuleScreenIntr = (startPoint, endPoint) => {
|
|
686
|
+
const screenLines = [
|
|
687
|
+
[{ x: 0, y: 0 }, { x: canvasWidth, y: 0 }],
|
|
688
|
+
[{ x: 0, y: 0 }, { x: 0, y: canvasHeight }],
|
|
689
|
+
[{ x: canvasWidth, y: 0 }, { x: canvasWidth, y: canvasHeight }],
|
|
690
|
+
[{ x: 0, y: canvasHeight }, { x: canvasWidth, y: canvasHeight }]
|
|
691
|
+
];
|
|
692
|
+
|
|
693
|
+
const intr = [];
|
|
694
|
+
|
|
695
|
+
for (let i = 0; i < screenLines.length; i++) {
|
|
696
|
+
const result = intersectionOfLine([startPoint, endPoint], [screenLines[i][0], screenLines[i][1]], true);
|
|
697
|
+
if (result) intr.push(result);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
if (intr.length === 0) return false; else {
|
|
701
|
+
return intr;
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
const getPosition = (start, end) => {
|
|
706
|
+
const startPoint = start.clone().project(five$1.camera);
|
|
707
|
+
const startLeft = (startPoint.x + 1) / 2 * canvasWidth;
|
|
708
|
+
const startTop = (-startPoint.y + 1) / 2 * canvasHeight;
|
|
709
|
+
const endPoint = end.clone().project(five$1.camera);
|
|
710
|
+
const endLeft = (endPoint.x + 1) / 2 * canvasWidth;
|
|
711
|
+
const endTop = (-endPoint.y + 1) / 2 * canvasHeight;
|
|
712
|
+
const distance = Math.sqrt(Math.pow(endLeft - startLeft, 2) + Math.pow(endTop - startTop, 2));
|
|
713
|
+
|
|
714
|
+
return {
|
|
715
|
+
startLeft,
|
|
716
|
+
startTop,
|
|
717
|
+
endLeft,
|
|
718
|
+
endTop,
|
|
719
|
+
distance
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
const getPositionAndVisible = (start, end, visibleOrigin) => {
|
|
724
|
+
const cameraPosition = five$1.camera.position;
|
|
725
|
+
const cameraDirection = five$1.camera.getWorldDirection(new three.Vector3());
|
|
726
|
+
const startAngle = start.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
|
|
727
|
+
const endAngle = end.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
|
|
728
|
+
const ruleLength = start.distanceTo(end);
|
|
729
|
+
const midPoint = end.clone().sub(end.clone().sub(start).divide(new three.Vector3(2, 2, 2)));
|
|
730
|
+
const disFromCameraToMid = midPoint.distanceTo(cameraPosition);
|
|
731
|
+
const { startLeft, startTop, endLeft, endTop, distance } = getPosition(start, end);
|
|
732
|
+
const rad = Math.PI / 2 - Math.atan2(endLeft - startLeft, startTop - endTop);
|
|
733
|
+
const deg = -(rad / Math.PI) * 180;
|
|
734
|
+
let visible = true;
|
|
735
|
+
if (!visibleOrigin) visible = false;
|
|
736
|
+
|
|
737
|
+
// 只显示拐点相连的线
|
|
738
|
+
if (!equal(start, visibleOrigin) && !equal(end, visibleOrigin)) {
|
|
739
|
+
visible = false;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// 线小于0.3m隐藏
|
|
743
|
+
if (ruleLength < 0.3) {
|
|
744
|
+
visible = false;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
if (startAngle > Math.PI / 2) {
|
|
748
|
+
visible = false;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if (endAngle > Math.PI / 2) {
|
|
752
|
+
visible = false;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
if (disFromCameraToMid / ruleLength > 8) {
|
|
756
|
+
visible = false;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
let labelOffset = 50;
|
|
760
|
+
let visibleLength = distance;
|
|
761
|
+
const intr = getRuleScreenIntr({ x: ~~startLeft, y: ~~startTop }, { x: ~~endLeft, y: ~~endTop });
|
|
762
|
+
|
|
763
|
+
if (intr && intr.length === 1) {
|
|
764
|
+
if (equal(start, visibleOrigin)) {
|
|
765
|
+
visibleLength = Math.sqrt(Math.pow(intr[0].x - startLeft, 2) + Math.pow(intr[0].y - startTop, 2));
|
|
766
|
+
labelOffset = visibleLength / distance * 50;
|
|
767
|
+
} else if (equal(end, visibleOrigin)) {
|
|
768
|
+
visibleLength = Math.sqrt(Math.pow(intr[0].x - endLeft, 2) + Math.pow(intr[0].y - endTop, 2));
|
|
769
|
+
labelOffset = 100 - visibleLength / distance * 50;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
if (intr && intr.length === 2) {
|
|
774
|
+
const middlePoint = {
|
|
775
|
+
x: (intr[0].x + intr[1].x) / 2,
|
|
776
|
+
y: (intr[0].y + intr[1].y) / 2
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
const distanceFromStart = Math.sqrt(Math.pow(middlePoint.x - startLeft, 2) + Math.pow(middlePoint.y - startTop, 2));
|
|
780
|
+
labelOffset = distanceFromStart / distance * 100;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
return {
|
|
784
|
+
startLeft,
|
|
785
|
+
startTop,
|
|
786
|
+
distance,
|
|
787
|
+
deg,
|
|
788
|
+
visible,
|
|
789
|
+
labelOffset,
|
|
790
|
+
ruleLength
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
const updatePanoRulerData = () => {
|
|
795
|
+
const panoIndex = five$1.panoIndex;
|
|
796
|
+
const rulerData = rulerDatas.find(data => data.panoIndex === panoIndex);
|
|
797
|
+
if (!rulerData) return $$invalidate(0, rulerItemProp = []);
|
|
798
|
+
|
|
799
|
+
// 非全景模式下隐藏所有标尺
|
|
800
|
+
if (five$1.currentMode !== five.Five.Mode.Panorama) return $$invalidate(0, rulerItemProp = []);
|
|
801
|
+
|
|
802
|
+
const cameraPosition = five$1.camera.position;
|
|
803
|
+
const cameraDirection = five$1.camera.getWorldDirection(new three.Vector3());
|
|
804
|
+
const startPoints = rulerData.lines.map(v => new three.Vector3(v.start[0], -v.start[1], -v.start[2]));
|
|
805
|
+
const endPoints = rulerData.lines.map(v => new three.Vector3(v.end[0], -v.end[1], -v.end[2]));
|
|
806
|
+
|
|
807
|
+
// 可以看到的角度最小的拐点
|
|
808
|
+
const [visibleOrigin] = startPoints.concat(endPoints).sort((pointA, pointB) => {
|
|
809
|
+
const angleA = pointA.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
|
|
810
|
+
const angleB = pointB.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
|
|
811
|
+
return angleA - angleB;
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
const data = rulerData.lines.map(line => {
|
|
815
|
+
var _a, _b;
|
|
816
|
+
const start = line.start;
|
|
817
|
+
const end = line.end;
|
|
818
|
+
const { startLeft, startTop, distance, deg, visible, labelOffset, ruleLength } = getPositionAndVisible(new three.Vector3(start[0], -start[1], -start[2]), new three.Vector3(end[0], -end[1], -end[2]), visibleOrigin);
|
|
819
|
+
const children = [];
|
|
820
|
+
|
|
821
|
+
if (line.children && ((_a = line.children) === null || _a === void 0
|
|
822
|
+
? void 0
|
|
823
|
+
: _a.length) > 0) {
|
|
824
|
+
(_b = line.children) === null || _b === void 0
|
|
825
|
+
? void 0
|
|
826
|
+
: _b.forEach(l => {
|
|
827
|
+
const start = l.start;
|
|
828
|
+
const end = l.end;
|
|
829
|
+
const { distance } = getPosition(new three.Vector3(start[0], -start[1], -start[2]), new three.Vector3(end[0], -end[1], -end[2]));
|
|
830
|
+
children.push({ width: distance, state: l.state });
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
return {
|
|
835
|
+
width: distance,
|
|
836
|
+
left: startLeft,
|
|
837
|
+
top: startTop,
|
|
838
|
+
rotateDeg: deg,
|
|
839
|
+
state: line.state,
|
|
840
|
+
children,
|
|
841
|
+
labelOffset,
|
|
842
|
+
visible,
|
|
843
|
+
labelElement: options.distanceText(ruleLength)
|
|
844
|
+
};
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
$$invalidate(0, rulerItemProp = data);
|
|
848
|
+
};
|
|
849
|
+
|
|
850
|
+
const nextFrameFreshRule = () => nextFrame(updatePanoRulerData);
|
|
851
|
+
const throttleFreshRule = throttle(updatePanoRulerData, 80);
|
|
852
|
+
|
|
853
|
+
svelte.onMount(() => {
|
|
854
|
+
updatePanoRulerData();
|
|
855
|
+
five$1.on('panoArrived', updatePanoRulerData);
|
|
856
|
+
five$1.on('modeChange', updatePanoRulerData);
|
|
857
|
+
five$1.on('cameraDirectionUpdate', nextFrameFreshRule);
|
|
858
|
+
five$1.on('movingToPano', nextFrameFreshRule);
|
|
859
|
+
five$1.on('mouseWheel', () => throttleFreshRule());
|
|
860
|
+
five$1.on('pinchGesture', () => throttleFreshRule());
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
svelte.onDestroy(() => {
|
|
864
|
+
five$1.off('panoArrived', updatePanoRulerData);
|
|
865
|
+
five$1.off('modeChange', updatePanoRulerData);
|
|
866
|
+
five$1.off('cameraDirectionUpdate', nextFrameFreshRule);
|
|
867
|
+
five$1.off('movingToPano', nextFrameFreshRule);
|
|
868
|
+
five$1.off('mouseWheel', () => throttleFreshRule());
|
|
869
|
+
five$1.off('pinchGesture', () => throttleFreshRule());
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
$$self.$$set = $$props => {
|
|
873
|
+
if ('five' in $$props) $$invalidate(1, five$1 = $$props.five);
|
|
874
|
+
if ('rulerDatas' in $$props) $$invalidate(2, rulerDatas = $$props.rulerDatas);
|
|
875
|
+
if ('options' in $$props) $$invalidate(3, options = $$props.options);
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
return [rulerItemProp, five$1, rulerDatas, options];
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
class RulerItems extends internal.SvelteComponent {
|
|
882
|
+
constructor(options) {
|
|
883
|
+
super();
|
|
884
|
+
internal.init(this, options, instance, create_fragment, internal.safe_not_equal, { five: 1, rulerDatas: 2, options: 3 });
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
class Controller {
|
|
889
|
+
constructor(five, params) {
|
|
890
|
+
var _a, _b;
|
|
891
|
+
Object.defineProperty(this, "five", {
|
|
892
|
+
enumerable: true,
|
|
893
|
+
configurable: true,
|
|
894
|
+
writable: true,
|
|
895
|
+
value: void 0
|
|
896
|
+
});
|
|
897
|
+
Object.defineProperty(this, "container", {
|
|
898
|
+
enumerable: true,
|
|
899
|
+
configurable: true,
|
|
900
|
+
writable: true,
|
|
901
|
+
value: document.createElement('div')
|
|
902
|
+
});
|
|
903
|
+
Object.defineProperty(this, "panoRulerProData", {
|
|
904
|
+
enumerable: true,
|
|
905
|
+
configurable: true,
|
|
906
|
+
writable: true,
|
|
907
|
+
value: void 0
|
|
908
|
+
});
|
|
909
|
+
Object.defineProperty(this, "rulerItems", {
|
|
910
|
+
enumerable: true,
|
|
911
|
+
configurable: true,
|
|
912
|
+
writable: true,
|
|
913
|
+
value: void 0
|
|
914
|
+
});
|
|
915
|
+
Object.defineProperty(this, "state", {
|
|
916
|
+
enumerable: true,
|
|
917
|
+
configurable: true,
|
|
918
|
+
writable: true,
|
|
919
|
+
value: {
|
|
920
|
+
enabled: false,
|
|
921
|
+
loaded: false,
|
|
922
|
+
options: {
|
|
923
|
+
className: '',
|
|
924
|
+
distanceText: (distance) => `${distance.toFixed(1)}m`,
|
|
925
|
+
},
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
this.five = five;
|
|
929
|
+
this.container.classList.add('panoRulerProPlugin-container');
|
|
930
|
+
this.container.setAttribute('style', `position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;`);
|
|
931
|
+
if (params) {
|
|
932
|
+
if (params.data) {
|
|
933
|
+
this.load(params.data);
|
|
934
|
+
}
|
|
935
|
+
this.state.options = Object.assign(Object.assign({}, this.state.options), (params.options || {}));
|
|
936
|
+
if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
|
|
937
|
+
this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
|
|
938
|
+
}
|
|
939
|
+
this.five.once('modelLoaded', async () => {
|
|
940
|
+
var _a, _b;
|
|
941
|
+
(_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
|
|
942
|
+
});
|
|
943
|
+
this.five.once('dispose', () => this.dispose());
|
|
944
|
+
}
|
|
945
|
+
async load(serverData) {
|
|
946
|
+
if (!this.five.work)
|
|
947
|
+
return;
|
|
948
|
+
const data = serverData.data;
|
|
949
|
+
if (!data)
|
|
950
|
+
throw new Error('标尺数据依赖不齐全!');
|
|
951
|
+
this.panoRulerProData = data;
|
|
952
|
+
this.state.loaded = true;
|
|
953
|
+
}
|
|
954
|
+
enable() {
|
|
955
|
+
if (!this.state.loaded)
|
|
956
|
+
return false;
|
|
957
|
+
if (this.state.enabled)
|
|
958
|
+
return true;
|
|
959
|
+
this.state.enabled = true;
|
|
960
|
+
this.render();
|
|
961
|
+
return true;
|
|
962
|
+
}
|
|
963
|
+
disable() {
|
|
964
|
+
if (!this.state.enabled)
|
|
965
|
+
return true;
|
|
966
|
+
this.state.enabled = false;
|
|
967
|
+
this.render();
|
|
968
|
+
return true;
|
|
969
|
+
}
|
|
970
|
+
async render() {
|
|
971
|
+
var _a;
|
|
972
|
+
if (this.state.enabled) {
|
|
973
|
+
if (!this.panoRulerProData || !this.container)
|
|
974
|
+
return;
|
|
975
|
+
this.rulerItems = new RulerItems({
|
|
976
|
+
target: this.container,
|
|
977
|
+
props: {
|
|
978
|
+
five: this.five,
|
|
979
|
+
rulerDatas: this.panoRulerProData,
|
|
980
|
+
options: this.state.options,
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
(_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
986
|
+
this.rulerItems = undefined;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
dispose() {
|
|
990
|
+
if (this.container) {
|
|
991
|
+
this.rulerItems.$destroy();
|
|
992
|
+
this.rulerItems = undefined;
|
|
993
|
+
}
|
|
994
|
+
this.container.remove();
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* 全景标尺插件
|
|
1000
|
+
*/
|
|
1001
|
+
const PanoRulerProPlugin = (five, params) => {
|
|
1002
|
+
return new Controller(five, params);
|
|
1003
|
+
};
|
|
1004
|
+
|
|
1005
|
+
exports.PanoRulerProPlugin = PanoRulerProPlugin;
|
|
1006
|
+
exports["default"] = PanoRulerProPlugin;
|