feat(manager): the floor plan editor reworked; Management -> Tables on the page rule; area colours

- Floor editor: one toolbar over the map and the panels (grid on / off, grid resolution Ultra high
  ... Very low, edit the shape, Fit width / Whole plan, undo, save), panels top-aligned and sticky.
- The floor's shape: a '+' on the edge under the pointer, press to add a corner (and drag it);
  resting on a corner shows a bubble to remove it (never below 3).
- Areas: resize handles on the sides and corners, a colour (pastel, see-through; floor_items.color,
  migration 0041), the name repeated in the corner when tables cover it (live maps too).
- Labels can be clicked again after they're placed (transparent fill, not none).
- Management -> Tables: <Page> with the tabs above (?tab=), the list as a container, toolbar
  buttons one height.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 15:17:45 +02:00
co-authored by Claude Opus 5.5
parent 476c55abc0
commit 244e93f827
17 changed files with 389 additions and 111 deletions
+15 -1
View File
@@ -54,8 +54,22 @@ test('what is saved', () => {
const l = layoutOf(data, 1)
const body = layoutBody(l)
assert.deepEqual(body.tables[0], { id: 1, x: 100, y: 100, width: 100, height: 100, rotation: 0, shape: 'square', seats: 4 })
assert.deepEqual(body.items[0], { kind: 'bar', x: 500, y: 50, width: 300, height: 50, rotation: 0, text: null })
assert.deepEqual(body.items[0], { kind: 'bar', x: 500, y: 50, width: 300, height: 50, rotation: 0, text: null, color: null })
assert.equal(sameLayout(l, layoutOf(data, 1)), true)
assert.deepEqual(planBody({ ...plan, name: ' Up ', background: { id: 4 }, outline: [[0, 0], [5, 5]] }),
{ name: 'Up', group_id: 10, width: 1000, height: 600, outline: null, grid_on: true, grid_size: 50, media_id: 4, background_opacity: 0.6 })
})
test('the floor’s shape: a corner added where the edge was pressed; an area resized by its handles', async () => {
const { addCornerAt, nearestEdge, resizeBox, coveredAreas } = await import('@xenia/floorplan/geometry')
const square = [[0, 0], [100, 0], [100, 100], [0, 100]]
const e = nearestEdge(square, [50, 4])
assert.equal(e.index, 0)
assert.deepEqual(addCornerAt(square, e.index, e.x, e.y, { width: 100, height: 100 }), [[0, 0], [50, 0], [100, 0], [100, 100], [0, 100]])
const area = { x: 100, y: 100, width: 100, height: 60 }
assert.deepEqual(resizeBox(area, 'e', 220, 0, { width: 500, height: 500 }), { x: 135, y: 100, width: 170, height: 60 })
assert.deepEqual(resizeBox(area, 'nw', 40, 40, { width: 500, height: 500, grid_on: true, grid_size: 20 }), { x: 95, y: 85, width: 110, height: 90 })
const named = { key: 'a', kind: 'area', text: 'Terrace', x: 200, y: 200, width: 300, height: 200 }
assert.equal(coveredAreas([named], []).size, 0)
assert.equal(coveredAreas([named], [{ x: 200, y: 200, width: 80, height: 80 }]).has('a'), true)
})