merged master into next
This commit is contained in:
commit
9f1463f410
|
@ -4,7 +4,6 @@ import React from 'react'
|
||||||
const title = 'Logic gate simulator'
|
const title = 'Logic gate simulator'
|
||||||
const description = 'A logic gate simulator made for infoeducatie 2019'
|
const description = 'A logic gate simulator made for infoeducatie 2019'
|
||||||
const url = 'https://logic-gate-simulator.herokuapp.com/'
|
const url = 'https://logic-gate-simulator.herokuapp.com/'
|
||||||
const thumbail = require('../../../assets/favicon.ico')
|
|
||||||
|
|
||||||
const Head = () => {
|
const Head = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -31,7 +30,6 @@ const Head = () => {
|
||||||
|
|
||||||
<meta property="og:title" content={title} />
|
<meta property="og:title" content={title} />
|
||||||
<meta property="og:description" content={description} />
|
<meta property="og:description" content={description} />
|
||||||
<meta property="og:image" content={`${url}${thumbail}`} />
|
|
||||||
<meta property="og:url" content={url} />
|
<meta property="og:url" content={url} />
|
||||||
|
|
||||||
<meta
|
<meta
|
||||||
|
|
|
@ -3,6 +3,6 @@ import { deleteGate } from '../../simulationRenderer/helpers/deleteGate'
|
||||||
|
|
||||||
export const deleteSelection = (renderer: SimulationRenderer) => {
|
export const deleteSelection = (renderer: SimulationRenderer) => {
|
||||||
for (const gate of renderer.getSelected()) {
|
for (const gate of renderer.getSelected()) {
|
||||||
deleteGate(renderer.simulation, gate)
|
deleteGate(renderer.simulation, gate, renderer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,4 +365,12 @@ export class SimulationRenderer {
|
||||||
this.selectedGates.permanent.clear()
|
this.selectedGates.permanent.clear()
|
||||||
this.selectedGates.temporary.clear()
|
this.selectedGates.temporary.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the selected pins of the renderer
|
||||||
|
*/
|
||||||
|
public clearPinSelection() {
|
||||||
|
this.selectedPins.end = null
|
||||||
|
this.selectedPins.start = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ import { Simulation } from '../../simulation/classes/Simulation'
|
||||||
* @param simulation The simulation to remove the gate from
|
* @param simulation The simulation to remove the gate from
|
||||||
* @param gate The gate to remove
|
* @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)
|
const node = simulation.gates.get(gate.id)
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
|
@ -26,4 +30,14 @@ export const deleteGate = (simulation: Simulation, gate: Gate) => {
|
||||||
|
|
||||||
gate.dispose()
|
gate.dispose()
|
||||||
simulation.gates.delete(node)
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue