Implemented the vector icon editor, library previews, and workspace camera controls.
Key changes: Component Options now has an “Edit Icon…” button instead of direct shape/color fields. Icon editor supports:Rectangles with configurable corner radius Circles and ellipses Lines Triangles Text Movable/selectable shapes Shape context menus Line style and width Solid or transparent fill Stroke and fill colours through Qt’s colour picker Editable shape dimensions Deleting selected shapes Input anchors are green and output anchors red; both can be dragged around the icon. Icons use a 120×80 vector coordinate system and are stored as editable elements in document JSON. Components render their vector icons directly in the workspace. Library and document trees display 16×16 icon previews. Added a Camera toolbar:Zoom In Zoom Out Center Mouse-wheel zoom works directly over the workspace. Icon changes and port positions support undo/redo.
This commit is contained in:
@@ -134,14 +134,22 @@ Every component owns its ports, declarative icon, properties, and child graph:
|
||||
"name": "My Component",
|
||||
"position": {"x": 0, "y": 0},
|
||||
"interface": {
|
||||
"inputs": [{"id": "in", "name": "Input"}],
|
||||
"outputs": [{"id": "out", "name": "Output"}]
|
||||
"inputs": [{"id": "in", "name": "Input", "properties": {
|
||||
"iconPosition": {"x": 0, "y": 40}
|
||||
}}],
|
||||
"outputs": [{"id": "out", "name": "Output", "properties": {
|
||||
"iconPosition": {"x": 120, "y": 40}
|
||||
}}]
|
||||
},
|
||||
"icon": {
|
||||
"shape": "rectangle",
|
||||
"fill": "#dbeafe",
|
||||
"border": "#245c9c",
|
||||
"text": "Component"
|
||||
"size": {"width": 120, "height": 80},
|
||||
"elements": [{
|
||||
"type": "rectangle", "x": 1, "y": 1,
|
||||
"width": 118, "height": 78,
|
||||
"cornerRadius": 5,
|
||||
"fill": "#dbeafe", "stroke": "#245c9c",
|
||||
"lineWidth": 1.5, "lineStyle": "solid"
|
||||
}]
|
||||
},
|
||||
"properties": {},
|
||||
"implementation": {
|
||||
@@ -157,8 +165,10 @@ Every component owns its ports, declarative icon, properties, and child graph:
|
||||
|
||||
Graph components use `"implementation": {"kind": "graph", "graph": ...}`;
|
||||
text components use `"implementation": {"kind": "text", "source": ...}` and
|
||||
never own a graph. Supported icon shapes are currently `rectangle` and
|
||||
`ellipse`. The recursive model is under `src/bedit/document/`, library loading
|
||||
never own a graph. Vector icons can contain rectangles, circles, ellipses,
|
||||
lines, triangles, and text. Each element owns its geometry, fill, stroke, and
|
||||
line style; ports keep their icon anchor in `properties.iconPosition`. The
|
||||
recursive model is under `src/bedit/document/`, library loading
|
||||
and the live Current Document tree are under `src/bedit/library/`, and graphics
|
||||
are isolated under `src/bedit/workspace/`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user