From 1c6524339d6cf45defedd8b9e8622d9475678d22 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Wed, 22 Jun 2022 15:48:14 +0200 Subject: [PATCH] Fix some small issues --- swing/src/net/sf/openrocket/gui/main/BasicFrame.java | 5 +++++ swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/main/BasicFrame.java b/swing/src/net/sf/openrocket/gui/main/BasicFrame.java index 81e242ef1..d99ba0fea 100644 --- a/swing/src/net/sf/openrocket/gui/main/BasicFrame.java +++ b/swing/src/net/sf/openrocket/gui/main/BasicFrame.java @@ -320,6 +320,11 @@ public class BasicFrame extends JFrame { component.addConfigListener(c); } } + + // Add the selection path to the tree selection + List paths = new LinkedList<>(Arrays.asList(tree.getSelectionPaths())); + paths.add(selPath); + tree.setSelectionPaths(paths.toArray(new TreePath[0])); } ComponentConfigDialog.showDialog(BasicFrame.this, BasicFrame.this.document, component); diff --git a/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java b/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java index 4a4d79232..1c89665db 100644 --- a/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java +++ b/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java @@ -607,11 +607,12 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change if (clicked == null || clicked.length == 0) return; - // Check for double-click. If the component was not already selected, ignore the double click and treat it as a single click + // Check for double-click. + // If the shift/meta key is not pressed and the component was not already selected, ignore the double click and treat it as a single click if (clickCount == 2) { if (event.isShiftDown() || event.isMetaDown()) { List paths = new ArrayList<>(Arrays.asList(selectionModel.getSelectionPaths())); - RocketComponent component = selectedComponents.get(0); + RocketComponent component = selectedComponents.get(selectedComponents.size() - 1); // Make sure the clicked component is selected for (RocketComponent c : clicked) {