Bellafaire / CircuiTikZ-Tool

UI application to speed up schematic drawing with LaTex CircuiTikZ
MIT License
68 stars 9 forks source link

Deleting components with backspace and delete #2

Closed mjmarques97 closed 4 years ago

mjmarques97 commented 4 years ago

Hello, I am a Mac user. The mac doesn't have de delete key. Would you mind adding the option to delete components with backspace? Nice work!

Bellafaire commented 4 years ago

As of Pre-release 0.0.6 right clicking a component will bring up a menu that includes deleteting a component. I'll leave this issue open to be fixed in the next version

mjmarques97 commented 4 years ago

In GUI.java: private void keyHandler(java.awt.event.KeyEvent evt) { System.out.print("Key pressed "); if (evt.getKeyCode() == KeyEvent.VK_DELETE) { //removing items in this manner causes a bug where the list doesn't update properly since it's controlled in circuitmaker.java schematicWindow.deleteSelectedComponent(); System.out.print("delete"); } System.out.println(""); }

Changing the if statement: if (evt.getKeyCode() == KeyEvent.VK_DELETE) to if (evt.getKeyCode() == KeyEvent.VK_DELETE || evt.getKeyCode()== KeyEvent.VK_BACK_SPACE)

Makes it possible to delete components with backspace

Bellafaire commented 4 years ago

Backspace now deletes components in the same way as the delete key does.