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:
@@ -88,6 +88,7 @@ class PlacedItem(BaseModel):
|
||||
height: float = Field(gt=0, le=6000)
|
||||
rotation: float = 0.0
|
||||
text: Optional[str] = Field(None, max_length=60)
|
||||
color: Optional[str] = Field(None, pattern=r"^#[0-9a-fA-F]{6}$") # an area's colour (2026-11-20)
|
||||
|
||||
|
||||
class LayoutBody(BaseModel):
|
||||
@@ -110,7 +111,7 @@ def plan_out(p: FloorPlan) -> dict:
|
||||
"media_id": p.media_id, "background": media_store.image_of(p.media) if p.media_id else None,
|
||||
"background_opacity": p.background_opacity,
|
||||
"items": [{"id": i.id, "kind": i.kind, "x": i.x, "y": i.y, "width": i.width, "height": i.height,
|
||||
"rotation": i.rotation, "text": i.text} for i in p.items],
|
||||
"rotation": i.rotation, "text": i.text, "color": i.color} for i in p.items],
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +212,8 @@ def save_layout(plan_id: int, body: LayoutBody, db: Session = Depends(get_db), u
|
||||
db.flush()
|
||||
for it in body.items:
|
||||
p.items.append(FloorItem(kind=it.kind, x=_inside(it.x, p.width), y=_inside(it.y, p.height), width=round(it.width, 1),
|
||||
height=round(it.height, 1), rotation=_rot(it.rotation), text=(it.text or "").strip() or None))
|
||||
height=round(it.height, 1), rotation=_rot(it.rotation), text=(it.text or "").strip() or None,
|
||||
color=it.color if it.kind == "area" else None))
|
||||
db.commit()
|
||||
db.refresh(p)
|
||||
_changed()
|
||||
|
||||
Reference in New Issue
Block a user