refactor: move floor plan editor into own widget
This commit is contained in:
+8
-2
@@ -133,6 +133,7 @@ function _buildRoomGroup(room) {
|
||||
_dimRoom = room;
|
||||
_dimGroup = group;
|
||||
_showDimensions(room, group.x(), group.y());
|
||||
notifyFlutter({ type: 'roomTapped', id: room.id });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -255,18 +256,22 @@ function _showDimensions(room, lx, ly) {
|
||||
dimensionsLayer.add(new Konva.Line({ points: [rx + rw, ry, hx + EXT, ry], stroke: c, strokeWidth: 0.8, listening: false }));
|
||||
dimensionsLayer.add(new Konva.Line({ points: [rx + rw, ry + rh, hx + EXT, ry + rh], stroke: c, strokeWidth: 0.8, listening: false }));
|
||||
dimensionsLayer.add(new Konva.Text({
|
||||
x: hx + 4, y: ry + rh / 2 - 4,
|
||||
x: hx - 10, y: ry + rh / 2,
|
||||
width: rh, align: 'center',
|
||||
text: `${room.height.toFixed(1)} m`,
|
||||
fontSize: 9, fill: c, listening: false,
|
||||
rotation: -90, offsetX: rh / 2, offsetY: 4.5,
|
||||
}));
|
||||
} else {
|
||||
// Inside the room near the right edge
|
||||
const hx = rx + rw - 18;
|
||||
dimensionsLayer.add(new Konva.Arrow({ ...arrowCfg, points: [hx, ry + 4, hx, ry + rh - 4] }));
|
||||
dimensionsLayer.add(new Konva.Text({
|
||||
x: hx - 22, y: ry + rh / 2 - 4,
|
||||
x: hx - 10, y: ry + rh / 2,
|
||||
width: rh, align: 'center',
|
||||
text: `${room.height.toFixed(1)} m`,
|
||||
fontSize: 9, fill: c, listening: false,
|
||||
rotation: -90, offsetX: rh / 2, offsetY: 4.5,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -508,6 +513,7 @@ stage.on('click tap', (e) => {
|
||||
if (e.target === stage) {
|
||||
_setTooltip(null);
|
||||
_clearDimensions();
|
||||
notifyFlutter({ type: 'selectionCleared' });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user