Skip to content

Commit

Permalink
Merge fc1eb46 into 007a679
Browse files Browse the repository at this point in the history
  • Loading branch information
BarbourSmith committed Jan 11, 2022
2 parents 007a679 + fc1eb46 commit 9e37051
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/js/molecules/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ export default class Code extends Atom {
GlobalVariables.c.fillText('</>', GlobalVariables.widthToPixels(this.x - (this.radius/1.5)), GlobalVariables.heightToPixels(this.y + (this.radius*1.5)))
}

/**
* Begin propagation from this code atom if it has no inputs or if none of the inputs are connected.
*/
beginPropagation(){
//If there are no inputs
if(this.inputs.length == 0){
this.updateValue()
}

//If none of the inputs are connected
var connectedInput = false
this.inputs.forEach(input => {
if(input.connectors.length > 0){
connectedInput = true
}
})
if(!connectedInput){
this.updateValue()
}
}

/**
* Grab the code as a text string and execute it.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/prototypes/atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ export default class Atom {
}

/**
* Starts propagation from this atom if it is not waiting for anything up stream.
* Starts propagation placeholder. Most atom types do not begin propagation.
*/
beginPropagation(){

Expand Down

0 comments on commit 9e37051

Please sign in to comment.