Merge pull request #1421 from SiboVG/issue-1420

[#1420] Add clicked component check
This commit is contained in:
SiboVG 2022-06-09 19:06:04 +02:00 committed by GitHub
commit b8b91ffac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -596,6 +596,8 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
List<RocketComponent> selectedComponents = Arrays.stream(selectionModel.getSelectionPaths()) List<RocketComponent> selectedComponents = Arrays.stream(selectionModel.getSelectionPaths())
.map(c -> (RocketComponent) c.getLastPathComponent()).collect(Collectors.toList()); .map(c -> (RocketComponent) c.getLastPathComponent()).collect(Collectors.toList());
if (clicked == null || clicked.length == 0) return;
// If the shift-button is held, add a newly clicked component to the selection path // If the shift-button is held, add a newly clicked component to the selection path
if ((event.isShiftDown() || event.isMetaDown()) && event.getClickCount() == 1) { if ((event.isShiftDown() || event.isMetaDown()) && event.getClickCount() == 1) {
List<TreePath> paths = new ArrayList<>(Arrays.asList(selectionModel.getSelectionPaths())); List<TreePath> paths = new ArrayList<>(Arrays.asList(selectionModel.getSelectionPaths()));