diff --git a/src/modules/core/components/Head.tsx b/src/modules/core/components/Head.tsx
index 337e005..14c0025 100644
--- a/src/modules/core/components/Head.tsx
+++ b/src/modules/core/components/Head.tsx
@@ -4,7 +4,6 @@ import React from 'react'
const title = 'Logic gate simulator'
const description = 'A logic gate simulator made for infoeducatie 2019'
const url = 'https://logic-gate-simulator.herokuapp.com/'
-const thumbail = require('../../../assets/favicon.ico')
const Head = () => {
return (
@@ -31,7 +30,6 @@ const Head = () => {
-
{
for (const gate of renderer.getSelected()) {
- deleteGate(renderer.simulation, gate)
+ deleteGate(renderer.simulation, gate, renderer)
}
}
diff --git a/src/modules/simulationRenderer/classes/SimulationRenderer.ts b/src/modules/simulationRenderer/classes/SimulationRenderer.ts
index fa906db..03404d1 100644
--- a/src/modules/simulationRenderer/classes/SimulationRenderer.ts
+++ b/src/modules/simulationRenderer/classes/SimulationRenderer.ts
@@ -365,4 +365,12 @@ export class SimulationRenderer {
this.selectedGates.permanent.clear()
this.selectedGates.temporary.clear()
}
+
+ /**
+ * Clears the selected pins of the renderer
+ */
+ public clearPinSelection() {
+ this.selectedPins.end = null
+ this.selectedPins.start = null
+ }
}
diff --git a/src/modules/simulationRenderer/helpers/deleteGate.ts b/src/modules/simulationRenderer/helpers/deleteGate.ts
index d42097c..da91063 100644
--- a/src/modules/simulationRenderer/helpers/deleteGate.ts
+++ b/src/modules/simulationRenderer/helpers/deleteGate.ts
@@ -9,7 +9,11 @@ import { Simulation } from '../../simulation/classes/Simulation'
* @param simulation The simulation to remove the gate from
* @param gate The gate to remove
*/
-export const deleteGate = (simulation: Simulation, gate: Gate) => {
+export const deleteGate = (
+ simulation: Simulation,
+ gate: Gate,
+ renderer?: SimulationRenderer
+) => {
const node = simulation.gates.get(gate.id)
if (!node) {
@@ -26,4 +30,14 @@ export const deleteGate = (simulation: Simulation, gate: Gate) => {
gate.dispose()
simulation.gates.delete(node)
+
+ if (
+ renderer &&
+ ((renderer.selectedPins.end &&
+ renderer.selectedPins.end.wrapper.value.gate === gate) ||
+ (renderer.selectedPins.start &&
+ renderer.selectedPins.start.wrapper.value.gate === gate))
+ ) {
+ renderer.clearPinSelection()
+ }
}