joker727's picture
Claude Sonnet 4.6
Initial clean deploy: Vastu AI floor plan generator
c05974a
Raw History Blame Contribute Delete
879 Bytes
import os
import streamlit.components.v1 as components
_COMPONENT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "frontend")
_floorplan_editor = components.declare_component(
"floorplan_editor",
path=_COMPONENT_DIR,
)
def floor_plan_editor(rooms, plot_w, plot_h, road_side, key=None):
"""
Interactive drag-and-drop floor plan editor component.
rooms: list of Room objects with .name, .x, .y, .w, .h attributes
Returns list of updated room dicts {name, x, y, w, h} or None if no changes applied.
"""
room_dicts = [
{"name": r.name, "x": float(r.x), "y": float(r.y), "w": float(r.w), "h": float(r.h)}
for r in rooms
]
return _floorplan_editor(
rooms=room_dicts,
plot_w=float(plot_w),
plot_h=float(plot_h),
road_side=road_side,
key=key,
default=None,
)