Skip to content

Commit dd377ff

Browse files
committed
fix drawying op amp from saved state
1 parent c052e73 commit dd377ff

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

circuitSolver/modules/View.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ export class View extends draw2d.Canvas {
176176
if (id) e.id = id;
177177
else e.id = `op${this.opCounter}`;
178178
this.opCounter = this.opCounter + 1;
179-
} else console.log("ERROR: You gave a bad type: ", type);
179+
} else {
180+
console.log("ERROR: You gave a bad type: ", type);
181+
return;
182+
}
180183

181184
this.x = x;
182185
this.y = y;
@@ -232,6 +235,7 @@ export class View extends draw2d.Canvas {
232235
else if (firstLetter == "i") type = "iin";
233236
else if (firstLetter == "x") type = "xvout";
234237
else if (firstLetter == "Y") type = "iprobe";
238+
else if (firstLetter == "o") type = "op";
235239
// console.log(item, type)
236240

237241
this.addShapeToSchem(type, item.x, item.y, item.id, item.angle);

circuitSolver/modules/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function navBar(props) {
5555
<div className="container-xl" key="cont">
5656
<div className="row" key="r1">
5757
<div className="col" key="title">
58-
<h4 className="mb-0" key="head"><strong><a href="/" style=${{'color':'#fff','text-decoration':'none'}}>${props.title}</a></strong></h4>
58+
<h4 className="mb-0" key="head"><strong><a href="/" style=${{'color':'#fff','textDecoration':'none'}}>${props.title}</a></strong></h4>
5959
</div>
6060
<div className="col-2" key="undo">
6161
<button type="button" className="btn btn-secondary py-0" title="undo" onClick=${(e) => props.onClickUndo(e)} key="undoB">
@@ -64,15 +64,15 @@ function navBar(props) {
6464
<path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z"></path>
6565
</svg>
6666
</button>
67-
<a href=${location.protocol + '//' + location.host + location.pathname} style=${{'color':'#fff','text-decoration':'none'}}>
67+
<a href=${location.protocol + '//' + location.host + location.pathname} style=${{'color':'#fff','textDecoration':'none'}}>
6868
<button type="button" className="btn btn-secondary py-0 ms-2" title="restart" key="undoC">
69-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16">
69+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" className="bi bi-x-circle" viewBox="0 0 16 16">
7070
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
7171
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
7272
</svg>
7373
</button></a>
7474
<button type="button" className="btn btn-secondary py-0 ms-2" title="share" onClick=${() => {navigator.clipboard.writeText(window.location.href); props.copiedToastURL.show()}} key="share">
75-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-share" viewBox="0 0 16 16">
75+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" className="bi bi-share" viewBox="0 0 16 16">
7676
<path d="M13.5 1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M11 2.5a2.5 2.5 0 1 1 .603 1.628l-6.718 3.12a2.5 2.5 0 0 1 0 1.504l6.718 3.12a2.5 2.5 0 1 1-.488.876l-6.718-3.12a2.5 2.5 0 1 1 0-3.256l6.718-3.12A2.5 2.5 0 0 1 11 2.5m-8.5 4a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m11 5.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3"/>
7777
</svg>
7878
</button>
@@ -1069,6 +1069,7 @@ class Game extends React.Component {
10691069
render() {
10701070
const current = this.state.history[this.state.history.length - 1];
10711071
// console.log("state", this.state)
1072+
// console.log("current", {...current})
10721073

10731074
//put the state into the URL
10741075
// Convert the object to a JSON string and encode it

circuitSolver/toDo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- if add op amp with zero on input and LC on output, and change input to current source, it crashes
2+
-- http://127.0.0.1:8000/?state=eJy1lM1ygjAUhd8laxYkRbRsWXQh0wVddrqgkCozkDAQHBnHd%252B8NYBW4ZqC1G1Hv%252BXLuHzkRnvGcC1UR70RCW38eoqzmxCPUtolFapEq%252BLGFr0laFVnUvEa5DoP4bBGf3iD0R15M5CAEeTiQ26bjOz0bZGTMh2kgwPOpJ%252FKgPd9nc9OH00H%252FlacCJbakjUbHQX3XAl90XNT5m%252BJF1YeqeM%252FzSKUx8d5PRDWFNoplXkgBE4EU0gT%252BOICjRSKxyyAMFDhQF54N8djKPVv3ydAeg4w5LUjXRnAnkjH5xDpLeJrI40HWasxu7I6lz8zE%252BvQKsnWfsNOj1IiGCHrJGGo2obKYdMlxNp2pa6wVFu4OyNbGbAM6BlfuvA5NHN1%252BoNCnhQO9kOOBCsFjlUq9c5Wsy5jrhRYy4TfTLWSpd3rffJZp0l4DKip3XN1I21THutlGIUYjLt3wBkK6xIYiNGLTte%252FX1Ux78S82SDPwrk3LXjQbjMZc%252FjQaf%252BZoHu0yt5ZFHZs5l%252B6mf%252BBLg7cM2RO2wCaY2bM%252F2qAXCGIzTUcvwMf5G0K1u7Q%253D
23

34

45

0 commit comments

Comments
 (0)