Skip to content

Commit

Permalink
Merge 635ae8c into f7b12d5
Browse files Browse the repository at this point in the history
  • Loading branch information
BarbourSmith committed Apr 3, 2020
2 parents f7b12d5 + 635ae8c commit c2feaa3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 68 deletions.
6 changes: 1 addition & 5 deletions dist/maslowWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -108821,11 +108821,7 @@ return d[d.length-1];};return ", funcName].join("");
switch (key) {
case 'assemble':
var inputs = values[0].map(Shape.fromGeometry);
if (values[1]) {
return Assembly(...inputs).drop('cutAway').toKeptGeometry();
} else {
return Assembly(...inputs).toDisjointGeometry();
}
return Assembly(...inputs).toDisjointGeometry();
case 'bounding box':
return Shape.fromGeometry(values[0]).measureBoundingBox();
case 'circle':
Expand Down
66 changes: 3 additions & 63 deletions src/js/molecules/assembly.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,14 @@ export default class Assembly extends Atom{
updateValue(){
if(this.inputs.every(x => x.ready)){
try{
var inputs = []
var inputValues = []
this.inputs.forEach( io => {
if(io.connectors.length > 0 && io.type == 'input'){
inputs.push(io.getValue())
inputValues.push(io.getValue())
}
})
const mappedInputs = inputs.map(x => {
return x
})

const values = [mappedInputs, this.removeCutawayGeometry]
const values = [inputValues]

this.basicThreadValueProcessing(values, "assemble")
this.clearAlert()
Expand All @@ -72,67 +69,12 @@ export default class Assembly extends Atom{
}
}

/**
* Updates the side bar to add check boxes to turn on and off different elements.
*/
updateSidebar(){
var sideBar = super.updateSidebar()

this.inputs.forEach(input => {
if(input.connectors.length != 0){

var shouldThisBeChecked = true
if(input.getValue().tags){ //Check to see if this part is currently being cut away
if(input.getValue().tags.indexOf("user/cutAway") > -1){
shouldThisBeChecked = false
}
}

this.createCheckbox(sideBar,input.name,shouldThisBeChecked,(event)=>{
var updatedValue = input.getValue()

if(!event.target.checked){ //If the box has just been unchecked
if(updatedValue.tags){
updatedValue.tags.push("user/cutAway")
}
else{
updatedValue.tags = ["user/cutAway"]
}
input.setValue(updatedValue)
}
else{
var index = updatedValue.tags.indexOf("user/cutAway")
if (index > -1) {
updatedValue.tags.splice(index, 1)
}
input.setValue(updatedValue)
}
})
}
})

//Add a checkbox for deciding if the cutaway geometry should be kept
this.createCheckbox(sideBar,"Remove Cutaway Geometry", this.removeCutawayGeometry,(event)=>{

if(!event.target.checked){ //If the box has just been unchecked
this.removeCutawayGeometry = false
this.updateValue()
}
else{
this.removeCutawayGeometry = true
this.updateValue()
}
})
}

/**
* Super class the default serialize function to save the inputs since this atom has variable numbers of inputs.
*/
serialize(savedObject){
var thisAsObject = super.serialize(savedObject)

thisAsObject.removeCutawayGeometry = this.removeCutawayGeometry

var ioValues = []
this.inputs.forEach(io => {
if (io.connectors.length > 0){
Expand All @@ -147,7 +89,5 @@ export default class Assembly extends Atom{
thisAsObject.ioValues = ioValues

return thisAsObject

}

}

0 comments on commit c2feaa3

Please sign in to comment.