@realsee/dnalogel 2.0.0-alpha.3 → 2.0.0-alpha.4

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.
@@ -36959,11 +36959,11 @@ var exports = {
36959
36959
  };
36960
36960
  const _requestAnimationFrame = window.requestAnimationFrame || ((fn) => setTimeout(fn, 16));
36961
36961
  const _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
36962
- function nextFrame(fn, delay = 0) {
36962
+ function nextFrame$1(fn, delay = 0) {
36963
36963
  if (delay <= 0)
36964
36964
  _requestAnimationFrame(fn);
36965
36965
  else
36966
- _requestAnimationFrame(() => nextFrame(fn, delay - 1));
36966
+ _requestAnimationFrame(() => nextFrame$1(fn, delay - 1));
36967
36967
  }
36968
36968
  function requestAnimationFrameInterval(callback, frame = 60) {
36969
36969
  let index = -1;
@@ -36987,7 +36987,7 @@ function requestAnimationFrameInterval(callback, frame = 60) {
36987
36987
  const Easing = Easing$1;
36988
36988
  function tween(from, to2, duration, easing = Easing.Linear.None) {
36989
36989
  const tween2 = new Tween(from).to(to2, duration).easing(easing);
36990
- nextFrame(() => tween2.start(0));
36990
+ nextFrame$1(() => tween2.start(0));
36991
36991
  const cancelAnimationFrame2 = requestAnimationFrameInterval((time) => {
36992
36992
  if (tween2.update(time) === false)
36993
36993
  cancelAnimationFrame2();
@@ -37159,6 +37159,514 @@ const CameraMovementPlugin = (five) => {
37159
37159
  rotate
37160
37160
  };
37161
37161
  };
37162
+ function samePointAt(point1, point2) {
37163
+ return point1.x === point2.x && point1.y === point2.y;
37164
+ }
37165
+ function sameK(k1, k2) {
37166
+ if (Math.abs(k1) === Infinity && Math.abs(k2) === Infinity)
37167
+ return true;
37168
+ return Math.abs(k1 - k2) < 1e-3;
37169
+ }
37170
+ function getK(point1, point2) {
37171
+ return (point2.y - point1.y) / (point2.x - point1.x);
37172
+ }
37173
+ function intersectionOfLine(linePoints1, linePoints2, needIntersectionInLine) {
37174
+ const k1 = getK(linePoints1[1], linePoints1[0]);
37175
+ const k2 = getK(linePoints2[1], linePoints2[0]);
37176
+ if (isNaN(k1) || isNaN(k2))
37177
+ return false;
37178
+ if (sameK(k1, k2))
37179
+ return false;
37180
+ if (pointOnLine(linePoints1[0], linePoints2))
37181
+ return linePoints1[0];
37182
+ if (pointOnLine(linePoints1[1], linePoints2))
37183
+ return linePoints1[1];
37184
+ if (pointOnLine(linePoints2[0], linePoints1))
37185
+ return linePoints2[0];
37186
+ if (pointOnLine(linePoints2[1], linePoints1))
37187
+ return linePoints2[1];
37188
+ if (needIntersectionInLine && !isIntersect(linePoints1, linePoints2))
37189
+ return false;
37190
+ const p1 = linePoints1[0];
37191
+ const p2 = linePoints2[0];
37192
+ if (Math.abs(k1) === Infinity) {
37193
+ return { x: p1.x, y: linePoints2[1].y - (linePoints2[1].x - p1.x) * k2 };
37194
+ }
37195
+ if (Math.abs(k2) === Infinity) {
37196
+ return { x: p2.x, y: linePoints1[1].y - (linePoints1[1].x - p2.x) * k1 };
37197
+ }
37198
+ const x = (p2.y - p1.y + k1 * p1.x - k2 * p2.x) / (k1 - k2);
37199
+ const y2 = k1 * x - k1 * p1.x + p1.y;
37200
+ return { x, y: y2 };
37201
+ }
37202
+ function pointOnLine(point, linePoints) {
37203
+ if (samePointAt(point, linePoints[0]))
37204
+ return true;
37205
+ if (samePointAt(point, linePoints[1]))
37206
+ return true;
37207
+ return (linePoints[0].x - point.x) * (point.x - linePoints[1].x) >= 0 && (linePoints[0].y - point.y) * (point.y - linePoints[1].y) >= 0 && sameK(getK(linePoints[0], point), getK(point, linePoints[1]));
37208
+ }
37209
+ function multi(p1, p2, p0) {
37210
+ return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
37211
+ }
37212
+ function isIntersect(linePoints1, linePoints2) {
37213
+ if (Math.max(linePoints1[0].x, linePoints1[1].x) >= Math.min(linePoints2[0].x, linePoints2[1].x) && Math.max(linePoints2[0].x, linePoints2[1].x) >= Math.min(linePoints1[0].x, linePoints1[1].x) && Math.max(linePoints1[0].y, linePoints1[1].y) >= Math.min(linePoints2[0].y, linePoints2[1].y) && multi(linePoints2[0], linePoints1[1], linePoints1[0]) * multi(linePoints1[1], linePoints2[1], linePoints1[0]) > 0 && multi(linePoints1[0], linePoints2[1], linePoints2[0]) * multi(linePoints2[1], linePoints1[1], linePoints2[0]) > 0)
37214
+ return 1;
37215
+ return 0;
37216
+ }
37217
+ function nextFrame(fn, delay = 0) {
37218
+ if (delay <= 0)
37219
+ requestAnimationFrame(fn);
37220
+ else
37221
+ requestAnimationFrame(() => nextFrame(fn, delay - 1));
37222
+ }
37223
+ const PanoRulerStyle = `<style type="text/css">
37224
+ .PanoRulerPlugin-rule-line {
37225
+ position: absolute;
37226
+ transform-origin: left center;
37227
+ width: 0;
37228
+ height: 0.0625rem;
37229
+ }
37230
+
37231
+ .PanoRulerPlugin-rule-line::after {
37232
+ content: '';
37233
+ position: absolute;
37234
+ left: -0.125rem;
37235
+ top: -0.1rem;
37236
+ width: 0.25rem;
37237
+ height: 0.25rem;
37238
+ border-radius: 50%;
37239
+ background: #FFFFFF;
37240
+ z-index: 1;
37241
+ animation: viewport-rule-point 0.1s 1s;
37242
+ animation-fill-mode: both;
37243
+ }
37244
+
37245
+ .PanoRulerPlugin-rule-line::before {
37246
+ content: '';
37247
+ position: absolute;
37248
+ right: -0.125rem;
37249
+ top: -0.1rem;
37250
+ width: 0.25rem;
37251
+ height: 0.25rem;
37252
+ border-radius: 50%;
37253
+ background: #FFFFFF;
37254
+ animation: viewport-rule-point 0.1s 1.5s;
37255
+ animation-fill-mode: both;
37256
+ }
37257
+
37258
+ .PanoRulerPlugin-rule-line em {
37259
+ background: #fff;
37260
+ display: block;
37261
+ height: 100%;
37262
+ animation: viewport-rule-line 0.5s ease 1s;
37263
+ animation-fill-mode: both;
37264
+ box-shadow: 0 0 0.25rem rgb(0 0 0 / 40%);
37265
+ }
37266
+
37267
+ .PanoRulerPlugin-rule-label {
37268
+ position: absolute;
37269
+ width: 0;
37270
+ height: 0;
37271
+ top: 0.0625rem;
37272
+ }
37273
+
37274
+ .PanoRulerPlugin-rule-label-name {
37275
+ position: absolute;
37276
+ padding: 0.1875rem 0.375rem;
37277
+ background: rgba(195,195,195,0.30);
37278
+ backdrop-filter: blur(0.25rem);
37279
+ border-radius: 6.25rem;
37280
+ border: 0.0625rem solid rgba(255,255,255,0.6);
37281
+ white-space: nowrap;
37282
+ overflow: hidden;
37283
+ color: #FFFFFF;
37284
+ font-weight: 500;
37285
+ font-size: 0.75rem;
37286
+ line-height: 1;
37287
+ -webkit-animation: viewport-rule-label 0.25s ease 1s;
37288
+ animation: viewport-rule-label 0.25s ease 1s;
37289
+ animation-fill-mode: both;
37290
+ box-shadow: inset 0 0 0.625rem 0 rgba(255,255,255,0.30);
37291
+ }
37292
+
37293
+ @keyframes viewport-rule-line {
37294
+ 0% { width: 0% }
37295
+ 100% { width: 100% }
37296
+ }
37297
+
37298
+ @keyframes viewport-rule-label {
37299
+ 0% { opacity: 0; transform: scaleX(0); }
37300
+ 100% { opacity: 1; transform: translate(-50%, -50%) scaleX(1); }
37301
+ }
37302
+
37303
+ @keyframes viewport-rule-point {
37304
+ 0% { transform: scaleX(0); }
37305
+ 100% { transform: scaleX(1); }
37306
+ }
37307
+ </style>
37308
+ `;
37309
+ const getDistance = (p1, p2) => {
37310
+ return Math.sqrt(Math.pow(p1.z - p2.z, 2) + Math.pow(p1.x - p2.x, 2));
37311
+ };
37312
+ const getRoomHeightInfo = (roomInfo, five) => {
37313
+ const roomHeightInfo = {};
37314
+ const raycaster = new Raycaster$1();
37315
+ const work = five.work;
37316
+ if (!work)
37317
+ return roomHeightInfo;
37318
+ const observers = roomInfo.observers;
37319
+ work.observers.forEach((observer, index) => {
37320
+ const { standingPosition: position } = observer;
37321
+ const point = new Vector3$1(position.x, position.y, position.z);
37322
+ raycaster.set(point, new Vector3$1(0, 1, 0));
37323
+ const [intersection] = five.model.intersectRaycaster(raycaster);
37324
+ const verticalY = intersection ? intersection.point.y : 2.7;
37325
+ const id = observers[index];
37326
+ if (!id)
37327
+ return roomHeightInfo;
37328
+ const observerRoomName = roomInfo.rooms[id].name;
37329
+ if (roomHeightInfo[observerRoomName] === void 0) {
37330
+ roomHeightInfo[observerRoomName] = {
37331
+ __roof: [verticalY],
37332
+ __floor: [point.y]
37333
+ };
37334
+ } else {
37335
+ roomHeightInfo[observerRoomName].__roof.push(verticalY);
37336
+ roomHeightInfo[observerRoomName].__floor.push(point.y);
37337
+ }
37338
+ });
37339
+ for (const roomName in roomHeightInfo) {
37340
+ const room = roomHeightInfo[roomName];
37341
+ room.__roof.sort();
37342
+ room.__floor.sort();
37343
+ room.floor = room.__floor[~~(room.__floor.length / 2)];
37344
+ room.roof = room.__roof[room.__roof.length - 1];
37345
+ }
37346
+ return roomHeightInfo;
37347
+ };
37348
+ const PanoRulerPlugin = (five, params) => {
37349
+ const state = {
37350
+ enable: false,
37351
+ loaded: false,
37352
+ options: params.options || {
37353
+ distanceText: (distance) => `${distance.toFixed(1)}m`
37354
+ }
37355
+ };
37356
+ const tpl = (name, distance) => {
37357
+ const domStr = `
37358
+ <div class="PanoRulerPlugin-rule-line">
37359
+ <em></em>
37360
+ <div class="PanoRulerPlugin-rule-label">
37361
+ <div class="PanoRulerPlugin-rule-label-name">${state.options.distanceText(distance)}</div>
37362
+ </div>
37363
+ </div>
37364
+ `;
37365
+ const res = document.createElement("div");
37366
+ res.setAttribute("class", "PanoRulerPlugin-rule");
37367
+ res.setAttribute("data-name", name);
37368
+ res.setAttribute("style", "display: none");
37369
+ res.innerHTML = domStr;
37370
+ return res;
37371
+ };
37372
+ const $rule = document.createElement("div");
37373
+ $rule.setAttribute("style", `position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;`);
37374
+ const style = document.createElement("div");
37375
+ style.innerHTML = PanoRulerStyle;
37376
+ $rule.appendChild(style);
37377
+ const __rule = {};
37378
+ const _load = (roomInfo, roomRules) => {
37379
+ if (state.loaded) {
37380
+ throw new Error("\u6807\u5C3A\u88AB\u91CD\u590D\u521D\u59CB\u5316\uFF01");
37381
+ }
37382
+ const roomHeightInfo = getRoomHeightInfo(roomInfo, five);
37383
+ const work = five.work;
37384
+ if (!work)
37385
+ return false;
37386
+ for (const obKey in roomRules) {
37387
+ const points = roomRules[obKey];
37388
+ const { standingPosition: defaultPosition } = work.observers[0];
37389
+ const roomPoints = points.map(({ x, z, observers }) => {
37390
+ const pointRoomName = observers.length > 0 ? roomInfo.rooms[roomInfo.observers[observers[0]]].name : "";
37391
+ const medianFloorHeight = roomHeightInfo[pointRoomName] ? roomHeightInfo[pointRoomName].floor : null;
37392
+ let minDistance = Infinity;
37393
+ let nearestPoint = {
37394
+ index: 0,
37395
+ x: defaultPosition.x,
37396
+ y: defaultPosition.y,
37397
+ z: defaultPosition.z
37398
+ };
37399
+ observers.forEach((index) => {
37400
+ if (!work.observers[index])
37401
+ return;
37402
+ const { standingPosition: position } = work.observers[index];
37403
+ const observerPoint = {
37404
+ index,
37405
+ x: position.x,
37406
+ y: position.y,
37407
+ z: position.z
37408
+ };
37409
+ const distance = getDistance({ x, z }, observerPoint);
37410
+ if (medianFloorHeight) {
37411
+ if (distance < minDistance && Math.abs(observerPoint.y - medianFloorHeight) < 0.3) {
37412
+ minDistance = distance;
37413
+ nearestPoint = observerPoint;
37414
+ }
37415
+ } else {
37416
+ if (distance < minDistance) {
37417
+ minDistance = distance;
37418
+ nearestPoint = observerPoint;
37419
+ }
37420
+ }
37421
+ });
37422
+ const _origin = new Vector3$1(x, nearestPoint.y, z);
37423
+ Object.assign(_origin, { observers });
37424
+ const verticalY = roomHeightInfo[pointRoomName] ? roomHeightInfo[pointRoomName].roof : null;
37425
+ const _vertical = !verticalY ? null : new Vector3$1(x, verticalY, z);
37426
+ if (_vertical)
37427
+ Object.assign(_vertical, { observers });
37428
+ const origin = _origin;
37429
+ const vertical = _vertical;
37430
+ return { origin, vertical };
37431
+ });
37432
+ __rule[obKey] = {
37433
+ origins: roomPoints.map((roomPoint) => roomPoint.origin),
37434
+ rules: []
37435
+ };
37436
+ for (const { origin, vertical } of roomPoints) {
37437
+ if (!vertical)
37438
+ continue;
37439
+ const $element = tpl(obKey, origin.distanceTo(vertical));
37440
+ $rule.append($element);
37441
+ __rule[obKey].rules.push({ vertical: true, rule: [origin, vertical], $element });
37442
+ }
37443
+ for (let index = 0; index < roomPoints.length; index++) {
37444
+ let nextIndex = index + 1;
37445
+ if (nextIndex >= roomPoints.length)
37446
+ nextIndex = 0;
37447
+ const { origin } = roomPoints[index];
37448
+ const { origin: next } = roomPoints[nextIndex];
37449
+ const $element = tpl(obKey, origin.distanceTo(next));
37450
+ $rule.append($element);
37451
+ __rule[obKey].rules.push({ vertical: false, rule: [origin, next], $element });
37452
+ }
37453
+ }
37454
+ state.loaded = true;
37455
+ return true;
37456
+ };
37457
+ const load = async (_roomInfo, _roomRules, options) => {
37458
+ const roomInfo = _roomInfo || params.roomInfo;
37459
+ const roomRules = _roomRules || params.roomRules;
37460
+ if (!roomInfo || !roomRules) {
37461
+ throw new Error("\u6807\u5C3A\u6570\u636E\u4F9D\u8D56\u4E0D\u9F50\u5168\uFF01");
37462
+ }
37463
+ state.options = Object.assign({}, state.options, options || {});
37464
+ if (five.model.loaded) {
37465
+ return _load(roomInfo, roomRules);
37466
+ } else {
37467
+ return await new Promise((resolve) => five.once("modelLoaded", () => resolve(_load(roomInfo, roomRules))));
37468
+ }
37469
+ };
37470
+ if (params.roomInfo && params.roomRules) {
37471
+ load(params.roomInfo, params.roomRules);
37472
+ }
37473
+ const getRuleScreenIntr = (startPoint, endPoint, canvasWidth, canvasHeight) => {
37474
+ const screenLines = [
37475
+ [
37476
+ { x: 0, y: 0 },
37477
+ { x: canvasWidth, y: 0 }
37478
+ ],
37479
+ [
37480
+ { x: 0, y: 0 },
37481
+ { x: 0, y: canvasHeight }
37482
+ ],
37483
+ [
37484
+ { x: canvasWidth, y: 0 },
37485
+ { x: canvasWidth, y: canvasHeight }
37486
+ ],
37487
+ [
37488
+ { x: 0, y: canvasHeight },
37489
+ { x: canvasWidth, y: canvasHeight }
37490
+ ]
37491
+ ];
37492
+ const intr = [];
37493
+ for (let i = 0; i < screenLines.length; i++) {
37494
+ const result = intersectionOfLine([startPoint, endPoint], [screenLines[i][0], screenLines[i][1]], true);
37495
+ if (result)
37496
+ intr.push(result);
37497
+ }
37498
+ if (intr.length === 0)
37499
+ return false;
37500
+ else {
37501
+ return intr;
37502
+ }
37503
+ };
37504
+ const freshRule = () => {
37505
+ var _a;
37506
+ const element2 = (_a = five.getElement()) == null ? void 0 : _a.parentElement;
37507
+ if (!element2)
37508
+ return;
37509
+ if (!state.loaded)
37510
+ return;
37511
+ if (Object.keys(__rule).length <= 0)
37512
+ return;
37513
+ const { panoIndex, camera, currentMode } = five;
37514
+ if (panoIndex === void 0)
37515
+ return;
37516
+ let name;
37517
+ for (const _name in __rule) {
37518
+ if (_name.split(",").indexOf(panoIndex.toString()) >= 0)
37519
+ name = _name;
37520
+ }
37521
+ if (!name)
37522
+ return;
37523
+ const cameraPosition = camera.position;
37524
+ const cameraDirection = camera.getWorldDirection(new Vector3$1());
37525
+ const width = element2.clientWidth;
37526
+ const height = element2.clientHeight;
37527
+ if (currentMode !== Five.Mode.Panorama) {
37528
+ for (const _name in __rule) {
37529
+ for (const { $element } of __rule[_name].rules) {
37530
+ $element.style.display = "none";
37531
+ }
37532
+ }
37533
+ return;
37534
+ }
37535
+ for (const _name in __rule) {
37536
+ for (const { $element } of __rule[_name].rules) {
37537
+ $element.style.display = _name === name ? "block" : "none";
37538
+ }
37539
+ }
37540
+ const [visibleOrigin] = __rule[name].origins.slice().filter((point) => point.observers.indexOf(panoIndex) >= 0).sort((pointA, pointB) => {
37541
+ const angleA = pointA.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
37542
+ const angleB = pointB.clone().setY(0).sub(cameraPosition).normalize().angleTo(cameraDirection.clone().setY(0));
37543
+ return angleA - angleB;
37544
+ });
37545
+ for (const { rule, vertical, $element } of __rule[name].rules) {
37546
+ const [start, end] = rule;
37547
+ const $line = $element.querySelector(".PanoRulerPlugin-rule-line");
37548
+ if (!$line)
37549
+ return;
37550
+ if (!visibleOrigin) {
37551
+ $element.style.display = "none";
37552
+ continue;
37553
+ }
37554
+ if (start !== visibleOrigin && end !== visibleOrigin) {
37555
+ $element.style.display = "none";
37556
+ continue;
37557
+ }
37558
+ if (start.distanceTo(end) < 0.5) {
37559
+ $element.style.display = "none";
37560
+ continue;
37561
+ }
37562
+ if (start.observers.indexOf(panoIndex) === -1 || end.observers.indexOf(panoIndex) === -1) {
37563
+ $element.style.display = "none";
37564
+ continue;
37565
+ }
37566
+ const startAngle = start.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
37567
+ if (startAngle > Math.PI / 2) {
37568
+ $element.style.display = "none";
37569
+ continue;
37570
+ }
37571
+ const endAngle = end.clone().sub(cameraPosition).normalize().angleTo(cameraDirection);
37572
+ if (endAngle > Math.PI / 2) {
37573
+ $element.style.display = "none";
37574
+ continue;
37575
+ }
37576
+ const ruleLength = start.distanceTo(end);
37577
+ const midPoint = end.clone().sub(end.clone().sub(start).divide(new Vector3$1(2, 2, 2)));
37578
+ const disFromCameraToMid = midPoint.distanceTo(cameraPosition);
37579
+ if (disFromCameraToMid / ruleLength > 8) {
37580
+ $element.style.display = "none";
37581
+ continue;
37582
+ }
37583
+ const mouseStart = start.clone().project(camera);
37584
+ const startLeft = (mouseStart.x + 1) / 2 * width;
37585
+ const startTop = (-mouseStart.y + 1) / 2 * height;
37586
+ const mouseEnd = end.clone().project(camera);
37587
+ const endLeft = (mouseEnd.x + 1) / 2 * width;
37588
+ const endTop = (-mouseEnd.y + 1) / 2 * height;
37589
+ const distance = Math.sqrt(Math.pow(endLeft - startLeft, 2) + Math.pow(endTop - startTop, 2));
37590
+ let visibleLength = distance;
37591
+ let labelOffset = 50;
37592
+ const intr = getRuleScreenIntr({ x: ~~startLeft, y: ~~startTop }, {
37593
+ x: ~~endLeft,
37594
+ y: ~~endTop
37595
+ }, width, height);
37596
+ if (intr && intr.length === 1) {
37597
+ if (visibleOrigin === start) {
37598
+ visibleLength = Math.sqrt(Math.pow(intr[0].x - startLeft, 2) + Math.pow(intr[0].y - startTop, 2));
37599
+ labelOffset = visibleLength / distance * 50;
37600
+ } else if (visibleOrigin === end) {
37601
+ visibleLength = Math.sqrt(Math.pow(intr[0].x - endLeft, 2) + Math.pow(intr[0].y - endTop, 2));
37602
+ labelOffset = 100 - visibleLength / distance * 50;
37603
+ }
37604
+ }
37605
+ if (intr && intr.length === 2) {
37606
+ const middlePoint = {
37607
+ x: (intr[0].x + intr[1].x) / 2,
37608
+ y: (intr[0].y + intr[1].y) / 2
37609
+ };
37610
+ const distanceFromStart = Math.sqrt(Math.pow(middlePoint.x - startLeft, 2) + Math.pow(middlePoint.y - startTop, 2));
37611
+ labelOffset = distanceFromStart / distance * 100;
37612
+ }
37613
+ const rad = Math.PI / 2 - Math.atan2(endLeft - startLeft, startTop - endTop);
37614
+ const deg = rad / Math.PI * 180;
37615
+ const $label = $line.querySelector(".PanoRulerPlugin-rule-label");
37616
+ const labelWidth = $label.children[0].clientWidth;
37617
+ if (labelWidth >= distance || labelWidth / 2 >= labelOffset / 100 * distance || labelWidth / 2 >= (1 - labelOffset / 100) * distance) {
37618
+ $line.style.display = "none";
37619
+ } else {
37620
+ $line.style.width = distance + "px";
37621
+ $line.style.left = startLeft + "px";
37622
+ $line.style.top = startTop + "px";
37623
+ $line.style.transform = `rotate(${-deg}deg)`;
37624
+ $label.style.left = `${labelOffset}%`;
37625
+ }
37626
+ }
37627
+ };
37628
+ const nextFrameFreshRule = () => nextFrame(freshRule);
37629
+ const throttleFreshRule = throttle(freshRule, 80);
37630
+ const enable = () => {
37631
+ var _a, _b;
37632
+ if (!state.loaded)
37633
+ return false;
37634
+ if (state.enable)
37635
+ return true;
37636
+ $rule.setAttribute("class", "PanoRulerPlugin" + (state.options.className ? " " + state.options.className : ""));
37637
+ (_b = (_a = five.getElement()) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.append($rule);
37638
+ freshRule();
37639
+ five.on("panoArrived", freshRule);
37640
+ five.on("modeChange", freshRule);
37641
+ five.on("cameraDirectionUpdate", nextFrameFreshRule);
37642
+ five.on("movingToPano", nextFrameFreshRule);
37643
+ five.on("mouseWheel", throttleFreshRule);
37644
+ five.on("pinchGesture", throttleFreshRule);
37645
+ state.enable = true;
37646
+ return true;
37647
+ };
37648
+ const disable = () => {
37649
+ if (!state.enable)
37650
+ return true;
37651
+ five.off("panoArrived", freshRule);
37652
+ five.off("modeChange", freshRule);
37653
+ five.off("cameraDirectionUpdate", nextFrameFreshRule);
37654
+ five.off("movingToPano", nextFrameFreshRule);
37655
+ five.off("mouseWheel", throttleFreshRule);
37656
+ five.off("pinchGesture", throttleFreshRule);
37657
+ if ($rule) {
37658
+ $rule.remove();
37659
+ }
37660
+ state.enable = false;
37661
+ return true;
37662
+ };
37663
+ return {
37664
+ enable,
37665
+ disable,
37666
+ load,
37667
+ state
37668
+ };
37669
+ };
37162
37670
  const textureLoader = new THREE.TextureLoader();
37163
37671
  async function loadTexture(url) {
37164
37672
  return new Promise((resolve, reject) => {
@@ -37285,4 +37793,4 @@ class PanoCompassController {
37285
37793
  this.five.needsRender = true;
37286
37794
  }
37287
37795
  }
37288
- export { CSS3DRenderPlugin, CameraMovementPlugin, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelRoomLabelPlugin, ModelViewPlugin, PanoCompassPlugin as PanoCompassPluginPlugin, PanoCursorRaycasterPlugin, PanoFloorplanRadarPlugin, TopviewFloorplanPlugin };
37796
+ export { CSS3DRenderPlugin, CameraMovementPlugin, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelRoomLabelPlugin, ModelViewPlugin, PanoCompassPlugin as PanoCompassPluginPlugin, PanoCursorRaycasterPlugin, PanoFloorplanRadarPlugin, PanoRulerPlugin, TopviewFloorplanPlugin };