[#1254] Fix simulation plot element stretching

The elements stretched because the panel dimensions were greater than the chartPanel maximum draw dimensions.
This commit is contained in:
SiboVG 2022-03-22 04:05:14 +01:00
parent b1067b6e48
commit a5ab27e055

View File

@ -3,6 +3,8 @@ package net.sf.openrocket.gui.plot;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.InputEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -58,6 +60,12 @@ public class SimulationPlotDialog extends JDialog {
final ChartPanel chartPanel = new SimulationChart(myPlot.getJFreeChart());
final JFreeChart jChart = myPlot.getJFreeChart();
panel.add(chartPanel, "grow, wrap 20lp");
// Ensures normal aspect-ratio of chart elements when resizing the panel
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
//// Description text
JLabel label = new StyledLabel(trans.get("PlotDialog.lbl.Chart"), -2);