Skip to content

Commit 80fe828

Browse files
code and readme updates
1 parent e896ecb commit 80fe828

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,19 @@ npm run preview
7272

7373
### Usage
7474

75-
1. Open the application in your browser.
76-
2. Use the toolbar to draw and manipulate circuit elements.
77-
3. Save your work using the save buttons.
78-
4. Load previously saved canvases and libraries using the load buttons.
75+
## Usage
76+
77+
1. Open the app trough the `npm run preview` or `npm run dev` commands.
78+
2. Start drawing your circuit on the canvas:
79+
- On the canvas, right-click to show the canvas menu, and select `Create Node`.
80+
- Right-click on the node to show the node menu, and select `Change Image` and select an image relevant to your circuit node.
81+
- Right-click on the node to show the node menu, and select `Add Port` and select the port location and type.
82+
- You can rename the circuit node label or port label by double-clicking on the label. The port or port label can also be deleted (right-click on the port to show the port menu and go from there).
83+
- After you are satisfied with your changes to the circuit node, and if you wish to save the circuit node to be able to reuse it in the current or a different circuit, you can right-click on the circuit node and press `Save Node to Library`.
84+
- You can reuse the node by right-clicking on the canvas and selecting `Add Node from Library`.
85+
- The connections between circuit nodes can be done by drag-and-dropping one port to the destination port (if it is a compatible port).
86+
87+
7988
8089
## Demo
8190
You can view the deployed version of the application [here](https://code-forge-temple.github.io/circuit-sketcher-app).

public/logo.ico

1 KB
Binary file not shown.

src/components/DrawBoard/DrawBoard.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ export const DrawBoard: React.FC = () => {
3434

3535
const blob = new Blob([JSON.stringify(JSON.parse(jsonStr), null, 4)], {type: "application/json"});
3636

37-
saveAs(blob, "canvas.json");
37+
saveAs(blob, "Circuit Sketcher Canvas.circuit-sketcher");
3838
};
3939

4040
const handleSaveLibrary = () => {
41+
const timestamp = new Date().getTime();
42+
const filename = `Circuit Sketcher Library-${timestamp}.circuit-sketcher.lib`;
4143
const blob = new Blob([LocalStorageManager.getLibrary(true)], {type: "application/json"});
42-
43-
saveAs(blob, "library.json");
44+
saveAs(blob, filename);
4445
};
4546

4647
const handleLoadCanvasClick = () => {
@@ -101,7 +102,7 @@ export const DrawBoard: React.FC = () => {
101102
<input
102103
type="file"
103104
ref={canvasFileInputRef}
104-
accept=".json"
105+
accept=".circuit-sketcher"
105106
onChange={handleCanvasFileChange}
106107
/>
107108
<button type="button" className="btn btn-primary icon-btn" onClick={handleSaveCanvas}><img src={saveIcon} alt="Save" /></button>
@@ -112,7 +113,7 @@ export const DrawBoard: React.FC = () => {
112113
<input
113114
type="file"
114115
ref={libraryFileInputRef}
115-
accept=".json"
116+
accept=".circuit-sketcher.lib,.lib"
116117
onChange={handleLibraryFileChange}
117118
/>
118119
<button type="button" className="btn btn-primary icon-btn" onClick={handleSaveLibrary} ><img src={saveIcon} alt="Save" /></button>

0 commit comments

Comments
 (0)