File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,8 @@ public void mousePressed(MouseEvent e) {
277277 else {
278278 Port p = screenSpace_portAt (e .getX (), e .getY ());
279279
280+ Main .selection .clear ();
281+
280282 //Link behaviour
281283 if (p != null ) {
282284 tool = new MakeLinkTool ();
@@ -401,14 +403,17 @@ public void keyPressed(KeyEvent e) {
401403 View v = Main .ui .view ;
402404
403405 // Cancel tool usage on escape press
404- if (e .getKeyChar () == KeyEvent .VK_ESCAPE ) {
406+ if (e .getKeyCode () == KeyEvent .VK_ESCAPE ) {
405407 if (v .curTool != null ) {
406408 v .curTool .cancel ();
407409 v .curTool = null ;
408410 }
409411 }
410412 // Delete selection
411- else if (e .getKeyChar () == KeyEvent .VK_DELETE ) {
413+ else if (( e .getKeyCode () == KeyEvent .VK_DELETE
414+ || e .getKeyCode () == KeyEvent .VK_BACK_SPACE
415+ || e .getKeyCode () == KeyEvent .VK_X )
416+ && !Main .selection .isEmpty ()) {
412417 Main .selection .deleteAll ();
413418 }
414419 // Pass to tool
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ public BaseTool lbUp(int x, int y) {
136136 public BaseTool keyDown (int key ) {
137137 switch (key ) {
138138 case KeyEvent .VK_X :
139+ case KeyEvent .VK_DELETE :
140+ case KeyEvent .VK_BACK_SPACE :
139141 Main .opStack .cancelCompoundOp ();
140142 link .highlight = false ;
141143 link .delete ();
Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ public BaseTool mouseDrag(int x, int y) {
6868
6969 @ Override
7070 public BaseTool keyDown (int key ) {
71- if (key == KeyEvent .VK_BACK_SPACE ) {
71+ if ( key == KeyEvent .VK_BACK_SPACE
72+ || key == KeyEvent .VK_DELETE
73+ || key == KeyEvent .VK_X ) {
7274 if (curve .removePt ()) return this ;
7375 else return null ;
7476 }
@@ -94,7 +96,9 @@ public void paintWorld(Graphics2D g) {
9496 public boolean startLink (int x , int y ) {
9597 source = ViewUtil .screenSpace_portAt (x , y );
9698 if (source != null ) {
97- working = true ;
99+ Main .selection .clear ();
100+
101+ working = true ;
98102 start = new Vec2 (x , y );
99103 curve = new BezierPath ();
100104
You can’t perform that action at this time.
0 commit comments