fix: board outline 3 bugs (cornerRadius fallback, top-left origin default, IPC rounded_rect arc delegation)
This commit is contained in:
@@ -30,13 +30,33 @@ class BoardOutlineCommands:
|
||||
shape = params.get("shape", "rectangle")
|
||||
width = params.get("width")
|
||||
height = params.get("height")
|
||||
center_x = params.get("centerX", 0)
|
||||
center_y = params.get("centerY", 0)
|
||||
radius = params.get("radius")
|
||||
corner_radius = params.get("cornerRadius", 0)
|
||||
# Accept both "cornerRadius" and "radius" (schema uses "radius" for rounded_rectangle)
|
||||
corner_radius = params.get("cornerRadius", params.get("radius", 0) if shape == "rounded_rectangle" else 0)
|
||||
points = params.get("points", [])
|
||||
unit = params.get("unit", "mm")
|
||||
|
||||
# Position: accept top-left corner (x/y) or center (centerX/centerY).
|
||||
# Default: top-left at (0,0) so the board occupies positive coordinate space
|
||||
# and is consistent with component placement coordinates.
|
||||
x = params.get("x")
|
||||
y = params.get("y")
|
||||
if x is not None or y is not None:
|
||||
ox = x if x is not None else 0.0
|
||||
oy = y if y is not None else 0.0
|
||||
center_x = ox + (width or 0) / 2.0
|
||||
center_y = oy + (height or 0) / 2.0
|
||||
else:
|
||||
raw_cx = params.get("centerX")
|
||||
raw_cy = params.get("centerY")
|
||||
if raw_cx is not None or raw_cy is not None:
|
||||
center_x = raw_cx if raw_cx is not None else 0.0
|
||||
center_y = raw_cy if raw_cy is not None else 0.0
|
||||
else:
|
||||
# No position given → place top-left at (0,0)
|
||||
center_x = (width or 0) / 2.0
|
||||
center_y = (height or 0) / 2.0
|
||||
|
||||
if shape not in ["rectangle", "circle", "polygon", "rounded_rectangle"]:
|
||||
return {
|
||||
"success": False,
|
||||
|
||||
Reference in New Issue
Block a user