Error handling + fixed pin connecting
This commit is contained in:
parent
d38ce7cd1b
commit
fbcfb76305
25 changed files with 431 additions and 45 deletions
src/modules/simulationRenderer/classes
|
@ -14,6 +14,7 @@ import { getPinPosition } from '../helpers/pinPosition'
|
|||
import { pointInCircle } from '../../../common/math/helpers/pointInCircle'
|
||||
import { SelectedPins } from '../types/SelectedPins'
|
||||
import { getRendererState } from '../../saving/helpers/getState'
|
||||
import { Wire } from '../../simulation/classes/Wire'
|
||||
|
||||
export class SimulationRenderer {
|
||||
public mouseDownOutput = new Subject<MouseEventInfo>()
|
||||
|
@ -104,11 +105,21 @@ export class SimulationRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.selectedPins.start && this.selectedPins.end) {
|
||||
console.log('Connecting!')
|
||||
console.log(getRendererState(this))
|
||||
if (
|
||||
this.selectedPins.start &&
|
||||
this.selectedPins.end &&
|
||||
this.selectedPins.end.wrapper.value.pairs.size === 0
|
||||
) {
|
||||
this.simulation.wires.push(
|
||||
new Wire(
|
||||
this.selectedPins.start.wrapper,
|
||||
this.selectedPins.end.wrapper
|
||||
)
|
||||
)
|
||||
this.selectedPins.start = null
|
||||
this.selectedPins.end = null
|
||||
|
||||
console.log(getRendererState(this))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue