floor-editor-ts 1.0.5 → 1.0.6

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.
@@ -64370,7 +64370,7 @@ var root_20 = /* @__PURE__ */ from_html(`<div class="absolute top-2 left-1/2 -tr
64370
64370
  var root_21 = /* @__PURE__ */ from_html(`<div class="absolute top-2 left-1/2 -translate-x-1/2 bg-emerald-600 text-white px-3 py-1 rounded-full text-xs shadow">Click to place text label · Esc to cancel</div>`);
64371
64371
  var root_22 = /* @__PURE__ */ from_html(`<div class="absolute top-2 left-1/2 -translate-x-1/2 bg-indigo-600 text-white px-3 py-1 rounded-full text-xs shadow"> </div>`);
64372
64372
  var root_1$5 = /* @__PURE__ */ from_html(`<!> <!> <!> <!> <div class="absolute bottom-2 right-2 bg-white/80 rounded px-2 py-1 text-xs text-gray-500 flex gap-3"><!> <!> <!> <span> </span> <button class="hover:text-gray-700" title="Zoom to Fit (F)">⊞ Fit</button> <button class="hover:text-gray-700" title="Toggle Grid (G)"> </button> <button class="hover:text-gray-700" title="Toggle Snap to Grid (S)"> </button> <button class="hover:text-gray-700" title="Toggle Furniture"> </button> <button class="hover:text-gray-700" title="Layer Visibility">🗂 Layers</button> <button class="hover:text-gray-700" title="Toggle Rulers"> </button> <button class="hover:text-gray-700" title="Toggle Mini-map"> </button></div> <!> <!> <!> <!> <!> <!> <!> <div class="absolute bottom-3 left-3 z-20 flex items-center gap-1 bg-white rounded-lg shadow-lg border border-gray-200 px-1 py-0.5"><button class="w-7 h-7 flex items-center justify-center rounded hover:bg-gray-100 text-gray-600 hover:text-gray-800 font-bold text-lg" title="Zoom Out (−)" aria-label="Zoom out">−</button> <button class="min-w-[3.5rem] h-7 flex items-center justify-center rounded hover:bg-gray-100 text-xs font-medium text-gray-600 hover:text-gray-800 tabular-nums" title="Reset to 100%" aria-label="Zoom to 100%"> </button> <button class="w-7 h-7 flex items-center justify-center rounded hover:bg-gray-100 text-gray-600 hover:text-gray-800 font-bold text-lg" title="Zoom In (+)" aria-label="Zoom in">+</button> <div class="w-px h-5 bg-gray-200"></div> <button class="w-7 h-7 flex items-center justify-center rounded hover:bg-gray-100 text-gray-500 hover:text-gray-700 text-sm" title="Zoom to Fit (F)" aria-label="Zoom to fit">⊞</button></div> <!>`, 1);
64373
- var root = /* @__PURE__ */ from_html(`<div class="w-full h-full relative overflow-hidden" role="application"><canvas class="block w-full h-full" tabindex="0" aria-label="Floor plan editor canvas"></canvas> <!></div>`);
64373
+ var root = /* @__PURE__ */ from_html(`<div class="w-full h-full relative overflow-hidden" role="application"><canvas aria-label="Floor plan editor canvas"></canvas> <!></div>`);
64374
64374
  function FloorPlanCanvas($$anchor, $$props) {
64375
64375
  push($$props, true);
64376
64376
  const $panMode = () => store_get(panMode, "$panMode", $$stores);
@@ -64475,6 +64475,9 @@ function FloorPlanCanvas($$anchor, $$props) {
64475
64475
  };
64476
64476
  let showGrid = /* @__PURE__ */ state(true);
64477
64477
  let showRulers = /* @__PURE__ */ state(true);
64478
+ user_effect(() => {
64479
+ if ($$props.viewOnly) set(showRulers, false);
64480
+ });
64478
64481
  let layerVis = /* @__PURE__ */ state(proxy({
64479
64482
  walls: true,
64480
64483
  doors: true,
@@ -64818,6 +64821,9 @@ function FloorPlanCanvas($$anchor, $$props) {
64818
64821
  canvas.height = get(height);
64819
64822
  }
64820
64823
  markDirty();
64824
+ if ($$props.viewOnly) requestAnimationFrame(() => {
64825
+ zoomToFit();
64826
+ });
64821
64827
  }
64822
64828
  function drawGrid() {
64823
64829
  if (!ctx || !get(showGrid)) return;
@@ -65257,7 +65263,7 @@ function FloorPlanCanvas($$anchor, $$props) {
65257
65263
  return `${Math.round(worldCm)}`;
65258
65264
  }
65259
65265
  function drawRulers() {
65260
- if (!ctx || !get(showRulers)) return;
65266
+ if (!ctx || !get(showRulers) || $$props.viewOnly) return;
65261
65267
  const R = RULER_SIZE;
65262
65268
  const fontSize = 9;
65263
65269
  const isImperial = get(dimSettings).units === "imperial";
@@ -66109,6 +66115,9 @@ function FloorPlanCanvas($$anchor, $$props) {
66109
66115
  const unsub1 = activeFloor.subscribe((f) => {
66110
66116
  set(currentFloor, f, true);
66111
66117
  markDirty();
66118
+ if ($$props.viewOnly && f) requestAnimationFrame(() => {
66119
+ zoomToFit();
66120
+ });
66112
66121
  if (!initialFitDone && f && f.walls.length > 0) {
66113
66122
  initialFitDone = true;
66114
66123
  requestAnimationFrame(() => {
@@ -67916,6 +67925,7 @@ function FloorPlanCanvas($$anchor, $$props) {
67916
67925
  event("keydown", $window, onKeyDown);
67917
67926
  event("keyup", $window, onKeyUp);
67918
67927
  var canvas_1 = child(div);
67928
+ let classes;
67919
67929
  bind_this(canvas_1, ($$value) => canvas = $$value, () => canvas);
67920
67930
  var node = sibling(canvas_1, 2);
67921
67931
  var consequent_20 = ($$anchor) => {
@@ -68426,7 +68436,9 @@ function FloorPlanCanvas($$anchor, $$props) {
68426
68436
  reset(div);
68427
68437
  template_effect(() => {
68428
68438
  var _$$get14;
68429
- return set_style(canvas_1, `cursor: ${(_$$get14 = get(cursorStyle)) !== null && _$$get14 !== void 0 ? _$$get14 : ""}`);
68439
+ classes = set_class(canvas_1, 1, "block w-full h-full", null, classes, { "pointer-events-none": $$props.viewOnly });
68440
+ set_attribute(canvas_1, "tabindex", $$props.viewOnly ? -1 : 0);
68441
+ set_style(canvas_1, `cursor: ${(_$$get14 = get(cursorStyle)) !== null && _$$get14 !== void 0 ? _$$get14 : ""}`);
68430
68442
  });
68431
68443
  delegated("mousedown", canvas_1, onMouseDown);
68432
68444
  delegated("mousemove", canvas_1, onMouseMove);