mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
FlatInspector: increase/decrease inspection level with Ctrl/Shift keys
This commit is contained in:
@@ -120,9 +120,6 @@ public class FlatInspector
|
||||
public void mouseMoved( MouseEvent e ) {
|
||||
lastX = e.getX();
|
||||
lastY = e.getY();
|
||||
inspectParentLevel = (e.isControlDown() ? 1 : 0)
|
||||
+ (e.isShiftDown() ? 2 : 0)
|
||||
+ (e.isAltDown() ? 4 : 0);
|
||||
inspect( lastX, lastY );
|
||||
}
|
||||
};
|
||||
@@ -133,6 +130,16 @@ public class FlatInspector
|
||||
KeyEvent keyEvent = (KeyEvent) e;
|
||||
int keyCode = keyEvent.getKeyCode();
|
||||
|
||||
if( e.getID() == KeyEvent.KEY_RELEASED ) {
|
||||
if( keyCode == KeyEvent.VK_CONTROL ) {
|
||||
inspectParentLevel++;
|
||||
inspect( lastX, lastY );
|
||||
} else if( keyCode == KeyEvent.VK_SHIFT && inspectParentLevel > 0 ) {
|
||||
inspectParentLevel--;
|
||||
inspect( lastX, lastY );
|
||||
}
|
||||
}
|
||||
|
||||
if( keyCode == KeyEvent.VK_ESCAPE ) {
|
||||
// consume pressed and released ESC key events to e.g. avoid that dialog is closed
|
||||
keyEvent.consume();
|
||||
@@ -191,6 +198,7 @@ public class FlatInspector
|
||||
inspect( lastX, lastY );
|
||||
} else {
|
||||
lastComponent = null;
|
||||
inspectParentLevel = 0;
|
||||
|
||||
if( highlightFigure != null )
|
||||
highlightFigure.getParent().remove( highlightFigure );
|
||||
@@ -402,6 +410,11 @@ public class FlatInspector
|
||||
if( inspectParentLevel > 0 )
|
||||
text += "\n\nParent level: " + inspectParentLevel;
|
||||
|
||||
if( inspectParentLevel > 0 )
|
||||
text += "\n(press Ctrl/Shift to increase/decrease level)";
|
||||
else
|
||||
text += "\n\n(press Ctrl key to inspect parent)";
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user