Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gsoc'24): Moving a component mess up the connected wires (#3928) #367

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/simulator/src/data/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ function loadModule(data, scope) {
data.labelDirection || oppositeDirection[fixDirection[obj.direction]]

// Sets delay
obj.propagationDelay = data.propagationDelay || obj.propagationDelay
if (data.propagationDelay === 0) {
obj.propagationDelay = 0;
} else {
obj.propagationDelay = data.propagationDelay || obj.propagationDelay;
}
obj.fixDirection()

// Restore other values
Expand Down
2 changes: 1 addition & 1 deletion src/simulator/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function clockTick() {
*/
export function showError(error: string) {
errorDetectedSet(true)
// if error ha been shown return
// if error has been shown return
if (error === prevErrorMessage) return
prevErrorMessage = error

Expand Down
8 changes: 4 additions & 4 deletions src/simulator/src/wire.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@ export default class Wire {
if (this.type === 'horizontal') {
if (this.node1.absY() !== this.y1) {
// if(this.checkConnections()){this.delete();return;}
n = new Node(this.node1.absX(), this.y1, 2, this.scope.root)
n = new Node(this.node2.absX(), this.node1.absY(), 2, this.scope.root);
this.converge(n)
updated = true
} else if (this.node2.absY() !== this.y2) {
// if(this.checkConnections()){this.delete();return;}
n = new Node(this.node2.absX(), this.y2, 2, this.scope.root)
n = new Node(this.node1.absX(), this.node2.absY(), 2, this.scope.root);
this.converge(n)
updated = true
}
} else if (this.type === 'vertical') {
if (this.node1.absX() !== this.x1) {
// if(this.checkConnections()){this.delete();return;}
n = new Node(this.x1, this.node1.absY(), 2, this.scope.root)
n = new Node(this.node1.absX(), this.node2.absY(), 2, this.scope.root);
this.converge(n)
updated = true
} else if (this.node2.absX() !== this.x2) {
// if(this.checkConnections()){this.delete();return;}
n = new Node(this.x2, this.node2.absY(), 2, this.scope.root)
n = new Node(this.node2.absX(), this.node1.absY(), 2, this.scope.root);
this.converge(n)
updated = true
}
Expand Down
Loading