floor-editor-ts 1.0.9 → 1.0.10

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.
@@ -64511,6 +64511,7 @@ function FloorPlanCanvas($$anchor, $$props) {
64511
64511
  const RULER_SIZE = 24;
64512
64512
  let detectedRooms = /* @__PURE__ */ state(proxy([]));
64513
64513
  let lastWallHash = "";
64514
+ const GRID = 20;
64514
64515
  const SNAP = 10;
64515
64516
  const MAGNETIC_SNAP = 15;
64516
64517
  const WALL_SNAP_DIST = 30;
@@ -64814,6 +64815,46 @@ function FloorPlanCanvas($$anchor, $$props) {
64814
64815
  markDirty();
64815
64816
  needsFitToCanvas = true;
64816
64817
  }
64818
+ function drawGrid() {
64819
+ if (!ctx || !get(showGrid)) return;
64820
+ const step = (get(currentSnapToGrid) ? get(currentGridSize) : GRID) * get(zoom);
64821
+ if (step < 4) return;
64822
+ ctx.strokeStyle = "#e8eaed";
64823
+ ctx.lineWidth = .5;
64824
+ const offX = (get(width) / 2 - get(camX) * get(zoom)) % step;
64825
+ const offY = (get(height) / 2 - get(camY) * get(zoom)) % step;
64826
+ for (let x = offX; x < get(width); x += step) {
64827
+ ctx.beginPath();
64828
+ ctx.moveTo(x, 0);
64829
+ ctx.lineTo(x, get(height));
64830
+ ctx.stroke();
64831
+ }
64832
+ for (let y = offY; y < get(height); y += step) {
64833
+ ctx.beginPath();
64834
+ ctx.moveTo(0, y);
64835
+ ctx.lineTo(get(width), y);
64836
+ ctx.stroke();
64837
+ }
64838
+ const majorStep = 100 * get(zoom);
64839
+ if (majorStep >= 20) {
64840
+ ctx.strokeStyle = "#d1d5db";
64841
+ ctx.lineWidth = .8;
64842
+ const mOffX = (get(width) / 2 - get(camX) * get(zoom)) % majorStep;
64843
+ const mOffY = (get(height) / 2 - get(camY) * get(zoom)) % majorStep;
64844
+ for (let x = mOffX; x < get(width); x += majorStep) {
64845
+ ctx.beginPath();
64846
+ ctx.moveTo(x, 0);
64847
+ ctx.lineTo(x, get(height));
64848
+ ctx.stroke();
64849
+ }
64850
+ for (let y = mOffY; y < get(height); y += majorStep) {
64851
+ ctx.beginPath();
64852
+ ctx.moveTo(0, y);
64853
+ ctx.lineTo(get(width), y);
64854
+ ctx.stroke();
64855
+ }
64856
+ }
64857
+ }
64817
64858
  /** Get point on wall at parameter t (0-1), handling curves */
64818
64859
  function wallPointAt(w, t) {
64819
64860
  if (w.curvePoint) {
@@ -65254,6 +65295,9 @@ function FloorPlanCanvas($$anchor, $$props) {
65254
65295
  }
65255
65296
  canvasDirty = false;
65256
65297
  ctx.clearRect(0, 0, get(width), get(height));
65298
+ ctx.fillStyle = "#f8f9fa";
65299
+ ctx.fillRect(0, 0, $$props.floorMaxWidth, $$props.floorMaxHeight);
65300
+ drawGrid();
65257
65301
  if (!$$props.viewOnly && get(layerVis).guides) drawGuides$1();
65258
65302
  drawBackgroundImage();
65259
65303
  const floor = get(currentFloor);