When a new key is bound other commands bound to this key are removed
- On binding new key existing keys are searched - If key is in use the old one is removed - ControlKey is updated with a placeholder key value #story[1197]
This commit is contained in:
@@ -114,7 +114,15 @@ public class KeyBindingsController {
|
||||
anchor.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||
// if a button was clicked
|
||||
if (currentButton != null) {
|
||||
System.out.println("button is clicked");
|
||||
// check if a button is already mapped to this key
|
||||
for (int i = 1; i < lstKey.getItems().size(); i++) {
|
||||
Button button = (Button)lstKey.getItems().get(i);
|
||||
// update buttons text and remove key binding from command
|
||||
if (button.getText() == event.getCode().toString()) {
|
||||
button.setText("");
|
||||
newKeyFactory.updateKey(button.getId(), button.getId());
|
||||
}
|
||||
}
|
||||
// update text on the button
|
||||
currentButton.setText(event.getCode().toString());
|
||||
// update the control key
|
||||
|
||||
Reference in New Issue
Block a user