floor-editor-ts 1.4.8 → 1.4.9
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/floor-editor.es.js
CHANGED
|
@@ -11910,6 +11910,11 @@ function emitCameraMappingChanged(data) {
|
|
|
11910
11910
|
if (!((_data$serial = data.serial) === null || _data$serial === void 0 ? void 0 : _data$serial.trim())) return;
|
|
11911
11911
|
emitFloorCallback("cameraMappingChanged", data);
|
|
11912
11912
|
}
|
|
11913
|
+
function emitCameraFloorClicked(serial) {
|
|
11914
|
+
const s = serial === null || serial === void 0 ? void 0 : serial.trim();
|
|
11915
|
+
if (!s) return;
|
|
11916
|
+
emitFloorCallback("cameraFloorClicked", { serial: s });
|
|
11917
|
+
}
|
|
11913
11918
|
function cameraItemToCallbackProps(item) {
|
|
11914
11919
|
var _item$props, _ref, _item$name, _item$props2;
|
|
11915
11920
|
if (!item.serial) return null;
|
|
@@ -66765,6 +66770,8 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
66765
66770
|
*/
|
|
66766
66771
|
let fovSelectionOnly = /* @__PURE__ */ state(false);
|
|
66767
66772
|
let draggingFovVertex = /* @__PURE__ */ state(null);
|
|
66773
|
+
/** Body-drag anchor (world) — same idea as zoneDragLast */
|
|
66774
|
+
let fovDragLast = /* @__PURE__ */ state(null);
|
|
66768
66775
|
let editingTextAnnotationId = /* @__PURE__ */ state(null);
|
|
66769
66776
|
let editingTextAnnotationPos = /* @__PURE__ */ state(proxy({
|
|
66770
66777
|
x: 0,
|
|
@@ -67240,18 +67247,18 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
67240
67247
|
for (const fi of get(currentFloor).furniture) {
|
|
67241
67248
|
var _fi$props2, _fi$props3;
|
|
67242
67249
|
if (fi.catalogId !== "camera" || !fi.serial) continue;
|
|
67243
|
-
if (!(get(selectedFovSerial) === fi.serial || get(currentSelectedId) === fi.id)) continue;
|
|
67244
67250
|
const mapStr = (_fi$props2 = fi.props) === null || _fi$props2 === void 0 ? void 0 : _fi$props2.mapCoordinates;
|
|
67245
67251
|
if (!mapStr) continue;
|
|
67246
67252
|
const pts = mapCoordinatesToWorldPoints(mapStr, bounds);
|
|
67247
67253
|
if (pts.length < 2) continue;
|
|
67254
|
+
const isActive = get(selectedFovSerial) === fi.serial || get(currentSelectedId) === fi.id;
|
|
67248
67255
|
const color = ((_fi$props3 = fi.props) === null || _fi$props3 === void 0 ? void 0 : _fi$props3.zoneColor) || fi.color || "#22c55e";
|
|
67249
67256
|
ctx.save();
|
|
67250
67257
|
ctx.strokeStyle = color;
|
|
67251
67258
|
ctx.fillStyle = color;
|
|
67252
|
-
ctx.globalAlpha = .22;
|
|
67253
|
-
ctx.lineWidth = 2.5;
|
|
67254
|
-
ctx.setLineDash([]);
|
|
67259
|
+
ctx.globalAlpha = isActive ? .28 : $$props.viewOnly ? .22 : .16;
|
|
67260
|
+
ctx.lineWidth = isActive ? 2.5 : 1.5;
|
|
67261
|
+
ctx.setLineDash(isActive ? [] : [6, 4]);
|
|
67255
67262
|
ctx.beginPath();
|
|
67256
67263
|
const first = worldToScreen(pts[0].x, pts[0].y);
|
|
67257
67264
|
ctx.moveTo(first.x, first.y);
|
|
@@ -67263,7 +67270,8 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
67263
67270
|
ctx.fill();
|
|
67264
67271
|
ctx.globalAlpha = 1;
|
|
67265
67272
|
ctx.stroke();
|
|
67266
|
-
|
|
67273
|
+
ctx.setLineDash([]);
|
|
67274
|
+
if (isActive && !$$props.viewOnly) for (let i = 0; i < pts.length; i++) {
|
|
67267
67275
|
const s = worldToScreen(pts[i].x, pts[i].y);
|
|
67268
67276
|
drawVertexIndexBadge(ctx, s.x, s.y, i, color, 9);
|
|
67269
67277
|
}
|
|
@@ -67984,7 +67992,7 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
67984
67992
|
else zoomToFit();
|
|
67985
67993
|
needsFitToCanvas = false;
|
|
67986
67994
|
}
|
|
67987
|
-
if (get(wallStart) || get(draggingFurnitureId) || get(draggingDoorId) || get(draggingWindowId) || get(draggingStairId) || get(draggingColumnId) || get(draggingWallEndpoint) || get(draggingWallParallel) || get(draggingCurveHandle) || get(draggingHandle) || get(draggingMultiSelect) || get(draggingRoomId) || get(draggingRoomLabelId) || get(draggingTextAnnotationId) || get(draggingGuideId) || get(draggingZoneId) || get(draggingFovVertex) != null || get(zoneRectDragStart) || get(zonePolyDraft).length > 0 || get(fovPolyDraft).length > 0 || get(currentTool) === "cameraFov" || get(measuring) || get(annotating) || get(currentPlacingId) || get(isPlacingStair) || get(isPlacingColumn) || get(marqueeStart) || get(isPanning)) canvasDirty = true;
|
|
67995
|
+
if (get(wallStart) || get(draggingFurnitureId) || get(draggingDoorId) || get(draggingWindowId) || get(draggingStairId) || get(draggingColumnId) || get(draggingWallEndpoint) || get(draggingWallParallel) || get(draggingCurveHandle) || get(draggingHandle) || get(draggingMultiSelect) || get(draggingRoomId) || get(draggingRoomLabelId) || get(draggingTextAnnotationId) || get(draggingGuideId) || get(draggingZoneId) || get(draggingFovVertex) != null || get(fovDragLast) || get(zoneRectDragStart) || get(zonePolyDraft).length > 0 || get(fovPolyDraft).length > 0 || get(currentTool) === "cameraFov" || get(measuring) || get(annotating) || get(currentPlacingId) || get(isPlacingStair) || get(isPlacingColumn) || get(marqueeStart) || get(isPanning)) canvasDirty = true;
|
|
67988
67996
|
updateDetectedRooms();
|
|
67989
67997
|
const selId = get(currentSelectedId);
|
|
67990
67998
|
const multiIds = get(currentSelectedIds);
|
|
@@ -69101,12 +69109,17 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
69101
69109
|
set(selectedFovSerial, fovHit.serial, true);
|
|
69102
69110
|
set(fovSelectionOnly, true);
|
|
69103
69111
|
set(draggingFovVertex, vIdx >= 0 ? vIdx : null, true);
|
|
69112
|
+
set(fovDragLast, vIdx >= 0 ? null : {
|
|
69113
|
+
x: wp.x,
|
|
69114
|
+
y: wp.y
|
|
69115
|
+
}, true);
|
|
69104
69116
|
set(selectedZoneId, null);
|
|
69105
69117
|
selectedElementId.set(fovHit.id);
|
|
69118
|
+
emitCameraFloorClicked(fovHit.serial);
|
|
69106
69119
|
set(selectedTextAnnotationId, null);
|
|
69107
69120
|
set(selectedAnnotationId, null);
|
|
69108
69121
|
set(selectedMeasurementId, null);
|
|
69109
|
-
|
|
69122
|
+
beginUndoGroup();
|
|
69110
69123
|
return;
|
|
69111
69124
|
}
|
|
69112
69125
|
if (((_$$get9 = get(currentFloor)) === null || _$$get9 === void 0 || (_$$get9 = _$$get9.zones) === null || _$$get9 === void 0 ? void 0 : _$$get9.length) && get(layerVis).zones) {
|
|
@@ -69444,6 +69457,7 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
69444
69457
|
if (fi) {
|
|
69445
69458
|
var _fi$props4;
|
|
69446
69459
|
selectElement(fi.id, e.shiftKey, e.ctrlKey || e.metaKey);
|
|
69460
|
+
if (fi.catalogId === "camera") emitCameraFloorClicked(fi.serial);
|
|
69447
69461
|
set(fovSelectionOnly, false);
|
|
69448
69462
|
if (fi.catalogId === "camera" && fi.serial && ((_fi$props4 = fi.props) === null || _fi$props4 === void 0 ? void 0 : _fi$props4.mapCoordinates)) {
|
|
69449
69463
|
set(selectedFovSerial, fi.serial, true);
|
|
@@ -69627,21 +69641,30 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
69627
69641
|
x: snap(get(mousePos).x),
|
|
69628
69642
|
y: snap(get(mousePos).y)
|
|
69629
69643
|
}, true);
|
|
69630
|
-
if (get(
|
|
69644
|
+
if (get(selectedFovSerial) && get(currentFloor) && (get(draggingFovVertex) != null || get(fovDragLast))) {
|
|
69631
69645
|
const bounds = getInteriorFloorBounds(get(currentFloor));
|
|
69632
69646
|
const cam = get(currentFloor).furniture.find((f) => f.catalogId === "camera" && f.serial === get(selectedFovSerial));
|
|
69633
69647
|
if (cam && bounds) {
|
|
69634
69648
|
var _cam$props2;
|
|
69635
69649
|
const pts = mapCoordinatesToWorldPoints((_cam$props2 = cam.props) === null || _cam$props2 === void 0 ? void 0 : _cam$props2.mapCoordinates, bounds);
|
|
69636
|
-
if (pts[get(draggingFovVertex)]) {
|
|
69650
|
+
if (get(draggingFovVertex) != null && pts[get(draggingFovVertex)]) {
|
|
69637
69651
|
const next = pts.map((p) => ({ ...p }));
|
|
69638
69652
|
next[get(draggingFovVertex)] = {
|
|
69639
69653
|
x: snap(get(mousePos).x),
|
|
69640
69654
|
y: snap(get(mousePos).y)
|
|
69641
69655
|
};
|
|
69642
69656
|
setCameraMapCoordinatesFromWorld(get(selectedFovSerial), next);
|
|
69657
|
+
} else if (get(fovDragLast) && pts.length) {
|
|
69658
|
+
const dx = get(mousePos).x - get(fovDragLast).x;
|
|
69659
|
+
const dy = get(mousePos).y - get(fovDragLast).y;
|
|
69660
|
+
set(fovDragLast, {
|
|
69661
|
+
x: get(mousePos).x,
|
|
69662
|
+
y: get(mousePos).y
|
|
69663
|
+
}, true);
|
|
69664
|
+
setCameraMapCoordinatesFromWorld(get(selectedFovSerial), translatePoints(pts, dx, dy));
|
|
69643
69665
|
}
|
|
69644
69666
|
}
|
|
69667
|
+
return;
|
|
69645
69668
|
}
|
|
69646
69669
|
if (get(draggingZoneId) && ((_$$get12 = get(currentFloor)) === null || _$$get12 === void 0 ? void 0 : _$$get12.zones)) {
|
|
69647
69670
|
const z = get(currentFloor).zones.find((z) => z.id === get(draggingZoneId));
|
|
@@ -69969,9 +69992,10 @@ function FloorPlanCanvas($$anchor, $$props) {
|
|
|
69969
69992
|
set(draggingZoneVertex, null);
|
|
69970
69993
|
set(zoneDragLast, null);
|
|
69971
69994
|
}
|
|
69972
|
-
if (get(draggingFovVertex) != null) {
|
|
69995
|
+
if (get(draggingFovVertex) != null || get(fovDragLast)) {
|
|
69973
69996
|
endUndoGroup();
|
|
69974
69997
|
set(draggingFovVertex, null);
|
|
69998
|
+
set(fovDragLast, null);
|
|
69975
69999
|
}
|
|
69976
70000
|
if (get(draggingRoomLabelId)) {
|
|
69977
70001
|
const dx = get(mousePos).x - roomLabelDragStart.x;
|