Remove redundant updatefigure/repaint calls

This commit is contained in:
SiboVG 2022-06-23 17:18:36 +02:00
parent 57aef9aa40
commit 742d558fd2

View File

@ -819,7 +819,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
sim.addChangeListener(new StateChangeListener() { sim.addChangeListener(new StateChangeListener() {
@Override @Override
public void stateChanged(EventObject e) { public void stateChanged(EventObject e) {
if (updateFlightData(sim)) { if (updateFlightData(sim) && sim.getFlightConfigurationId() == document.getSelectedConfiguration().getFlightConfigurationID()) {
// TODO HIGH: this gets updated for every sim run; not necessary... // TODO HIGH: this gets updated for every sim run; not necessary...
updateFigures(); updateFigures();
} }
@ -972,8 +972,10 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
// Only set the flight data information of the current flight configuration // Only set the flight data information of the current flight configuration
extraText.setCalculatingData(false); extraText.setCalculatingData(false);
figure.repaint(); if (!is3d)
figure3d.repaint(); figure.repaint();
else
figure3d.repaint();
document.fireDocumentChangeEvent(new SimulationChangeEvent(simulation)); document.fireDocumentChangeEvent(new SimulationChangeEvent(simulation));
// Run the new simulation after this one has ended // Run the new simulation after this one has ended
@ -1002,8 +1004,10 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
backgroundSimulationWorker = null; backgroundSimulationWorker = null;
extraText.setFlightData(FlightData.NaN_DATA); extraText.setFlightData(FlightData.NaN_DATA);
extraText.setCalculatingData(false); extraText.setCalculatingData(false);
figure.repaint(); if (!is3d)
figure3d.repaint(); figure.repaint();
else
figure3d.repaint();
} }
} }