Merge pull request #34 from bkuker/kruland-integration-unselect
Unselect component when figure is clicked outside the rocket
This commit is contained in:
commit
31f620d1bd
@ -267,13 +267,17 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
gl.glDisable(GLLightingFunc.GL_LIGHTING);
|
gl.glDisable(GLLightingFunc.GL_LIGHTING);
|
||||||
final RocketComponent picked = rr.pick(drawable, configuration,
|
final RocketComponent picked = rr.pick(drawable, configuration,
|
||||||
pickPoint, pickEvent.isShiftDown() ? selection : null);
|
pickPoint, pickEvent.isShiftDown() ? selection : null);
|
||||||
if (csl != null && picked != null) {
|
if (csl != null) {
|
||||||
final MouseEvent e = pickEvent;
|
final MouseEvent e = pickEvent;
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
csl.componentClicked(new RocketComponent[] { picked },
|
if ( picked == null ){
|
||||||
e);
|
log.debug("unselecting");
|
||||||
|
csl.componentClicked(new RocketComponent[] { }, e);
|
||||||
|
} else {
|
||||||
|
csl.componentClicked(new RocketComponent[] { picked }, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -530,8 +530,10 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
private void handleComponentClick(RocketComponent[] clicked, MouseEvent event){
|
private void handleComponentClick(RocketComponent[] clicked, MouseEvent event){
|
||||||
|
|
||||||
// If no component is clicked, do nothing
|
// If no component is clicked, do nothing
|
||||||
if (clicked.length == 0)
|
if (clicked.length == 0){
|
||||||
|
selectionModel.setSelectionPath(null);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether the currently selected component is in the clicked components.
|
// Check whether the currently selected component is in the clicked components.
|
||||||
TreePath path = selectionModel.getSelectionPath();
|
TreePath path = selectionModel.getSelectionPath();
|
||||||
@ -827,6 +829,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
TreePath[] paths = selectionModel.getSelectionPaths();
|
TreePath[] paths = selectionModel.getSelectionPaths();
|
||||||
if (paths == null) {
|
if (paths == null) {
|
||||||
figure.setSelection(null);
|
figure.setSelection(null);
|
||||||
|
figure3d.setSelection(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user