Fix some small issues

This commit is contained in:
SiboVG 2022-06-22 15:48:14 +02:00
parent e1bd4c07d1
commit 1c6524339d
2 changed files with 8 additions and 2 deletions

View File

@ -320,6 +320,11 @@ public class BasicFrame extends JFrame {
component.addConfigListener(c); component.addConfigListener(c);
} }
} }
// Add the selection path to the tree selection
List<TreePath> 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); ComponentConfigDialog.showDialog(BasicFrame.this, BasicFrame.this.document, component);

View File

@ -607,11 +607,12 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
if (clicked == null || clicked.length == 0) return; 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 (clickCount == 2) {
if (event.isShiftDown() || event.isMetaDown()) { if (event.isShiftDown() || event.isMetaDown()) {
List<TreePath> paths = new ArrayList<>(Arrays.asList(selectionModel.getSelectionPaths())); List<TreePath> 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 // Make sure the clicked component is selected
for (RocketComponent c : clicked) { for (RocketComponent c : clicked) {