floor-editor-ts 1.4.3 → 1.4.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.
@@ -65492,6 +65492,7 @@ delegate(["click", "keydown"]);
65492
65492
  //#endregion
65493
65493
  //#region src/lib/components/sidebar/CameraFovEditor.svelte
65494
65494
  init_client();
65495
+ init_index_client();
65495
65496
  var root_3$5 = /* @__PURE__ */ from_html(`<button type="button" class="text-[10px] px-1.5 py-0.5 rounded border border-gray-300 hover:bg-white">Done</button> <button type="button" class="text-[10px] px-1.5 py-0.5 rounded border border-gray-300 hover:bg-white">Cancel</button>`, 1);
65496
65497
  var root_5$2 = /* @__PURE__ */ from_html(`<button type="button" class="text-[10px] px-1.5 py-0.5 rounded border border-red-200 text-red-600 hover:bg-red-50">Clear</button>`);
65497
65498
  var root_4$4 = /* @__PURE__ */ from_html(`<button type="button" class="text-[10px] px-1.5 py-0.5 rounded border border-blue-300 text-blue-700 bg-blue-50 hover:bg-blue-100"> </button> <!>`, 1);
@@ -65515,6 +65516,11 @@ function CameraFovEditor($$anchor, $$props) {
65515
65516
  let matchOk = /* @__PURE__ */ user_derived(() => fovPointCountsMatch(coordinates(), mapCoordinates()));
65516
65517
  let mapN = /* @__PURE__ */ user_derived(() => countCoordinatePoints(mapCoordinates()));
65517
65518
  let imgN = /* @__PURE__ */ user_derived(() => countCoordinatePoints(coordinates()));
65519
+ function samePoints(a, b) {
65520
+ if (a.length !== b.length) return false;
65521
+ for (let i = 0; i < a.length; i++) if (a[i].x !== b[i].x || a[i].y !== b[i].y) return false;
65522
+ return true;
65523
+ }
65518
65524
  user_effect(() => {
65519
65525
  var _$$props$thumbnailUrl;
65520
65526
  const url = (_$$props$thumbnailUrl = $$props.thumbnailUrl) === null || _$$props$thumbnailUrl === void 0 ? void 0 : _$$props$thumbnailUrl.trim();
@@ -65532,7 +65538,6 @@ function CameraFovEditor($$anchor, $$props) {
65532
65538
  w: img.naturalWidth,
65533
65539
  h: img.naturalHeight
65534
65540
  }, true);
65535
- redraw();
65536
65541
  };
65537
65542
  img.onerror = () => {
65538
65543
  if (cancelled) return;
@@ -65545,13 +65550,18 @@ function CameraFovEditor($$anchor, $$props) {
65545
65550
  };
65546
65551
  });
65547
65552
  user_effect(() => {
65548
- coordinates();
65549
- get(imgSize);
65550
- get(canvasEl);
65551
- if (!get(editing) && get(imgSize)) {
65552
- set(draft, coordinatesToImagePoints(coordinates(), get(imgSize)), true);
65553
+ const coords = coordinates();
65554
+ const size = get(imgSize);
65555
+ const el = get(canvasEl);
65556
+ const isEditing = get(editing);
65557
+ if (!size || !el) return;
65558
+ untrack(() => {
65559
+ if (!isEditing) {
65560
+ const next = coordinatesToImagePoints(coords, size);
65561
+ if (!samePoints(get(draft), next)) set(draft, next, true);
65562
+ }
65553
65563
  redraw();
65554
- } else if (get(imgSize) && get(canvasEl)) redraw();
65564
+ });
65555
65565
  });
65556
65566
  function scale() {
65557
65567
  if (!get(imgSize)) return 1;