Input fixes [release]

This commit is contained in:
crschnick 2024-07-26 16:25:04 +00:00
parent f0a91e09c5
commit 3357c73aea
5 changed files with 15 additions and 14 deletions

View file

@ -119,13 +119,13 @@ public class OpenFileSystemComp extends SimpleComp {
});
InputHelper.onKeyCombination(
root, new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN), true, keyEvent -> {
root, new KeyCodeCombination(KeyCode.F, KeyCombination.SHORTCUT_DOWN), true, keyEvent -> {
filter.toggleButton().fire();
filter.textField().requestFocus();
keyEvent.consume();
});
InputHelper.onKeyCombination(
root, new KeyCodeCombination(KeyCode.L, KeyCombination.CONTROL_DOWN), true, keyEvent -> {
root, new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN), true, keyEvent -> {
navBar.textField().requestFocus();
keyEvent.consume();
});

View file

@ -220,7 +220,7 @@ public class BrowserSessionTabsComp extends SimpleComp {
}
}
var forward = new KeyCodeCombination(KeyCode.TAB, KeyCombination.CONTROL_DOWN);
var forward = new KeyCodeCombination(KeyCode.TAB, KeyCombination.SHORTCUT_DOWN);
if (forward.match(keyEvent)) {
var next = (tabs.getSelectionModel().getSelectedIndex() + 1)
% tabs.getTabs().size();
@ -229,7 +229,7 @@ public class BrowserSessionTabsComp extends SimpleComp {
return;
}
var back = new KeyCodeCombination(KeyCode.TAB, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN);
var back = new KeyCodeCombination(KeyCode.TAB, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN);
if (back.match(keyEvent)) {
var previous = (tabs.getTabs().size() + tabs.getSelectionModel().getSelectedIndex() - 1)
% tabs.getTabs().size();

View file

@ -13,6 +13,7 @@ import io.xpipe.app.storage.DataStorage;
import javafx.beans.binding.Bindings;
import javafx.beans.value.ObservableValue;
import javafx.scene.Parent;
import javafx.scene.control.ButtonBase;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyEvent;
@ -61,7 +62,7 @@ public class AppLayoutComp extends Comp<CompStructure<Pane>> {
sidebarR.getChildrenUnmodifiable().forEach(node -> {
var shortcut = (KeyCodeCombination) node.getProperties().get("shortcut");
if (shortcut != null && shortcut.match(event)) {
((ButtonBase) node).fire();
((ButtonBase) ((Parent) node).getChildrenUnmodifiable().get(1)).fire();
event.consume();
return;
}

View file

@ -71,9 +71,6 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
value.setValue(e);
});
var shortcut = e.combination();
if (shortcut != null) {
b.apply(struc -> struc.get().getProperties().put("shortcut", shortcut));
}
b.apply(new TooltipAugment<>(e.name(), shortcut));
b.apply(struc -> {
AppFont.setSize(struc.get(), 1);
@ -112,6 +109,9 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
selectedBorder,
noneBorder));
});
if (shortcut != null) {
stack.apply(struc -> struc.get().getProperties().put("shortcut", shortcut));
}
vbox.getChildren().add(stack.createRegion());
}

View file

@ -78,19 +78,19 @@ public class AppLayoutModel {
"mdi2f-file-cabinet",
new BrowserSessionComp(BrowserSessionModel.DEFAULT),
null,
new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.CONTROL_DOWN)),
new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.SHORTCUT_DOWN)),
new Entry(
AppI18n.observable("connections"),
"mdi2c-connection",
new StoreLayoutComp(),
null,
new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.CONTROL_DOWN)),
new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.SHORTCUT_DOWN)),
new Entry(
AppI18n.observable("settings"),
"mdsmz-miscellaneous_services",
new AppPrefsComp(),
null,
new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.CONTROL_DOWN)),
new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.SHORTCUT_DOWN)),
new Entry(
AppI18n.observable("explorePlans"),
"mdi2p-professional-hexagon",
@ -102,20 +102,20 @@ public class AppLayoutModel {
"mdi2g-github",
null,
() -> Hyperlinks.open(Hyperlinks.GITHUB),
new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.CONTROL_DOWN)),
null),
new Entry(
AppI18n.observable("discord"),
"mdi2d-discord",
null,
() -> Hyperlinks.open(Hyperlinks.DISCORD),
new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.CONTROL_DOWN)),
null),
new Entry(
AppI18n.observable("api"),
"mdi2c-code-json",
null,
() -> Hyperlinks.open(
"http://localhost:" + AppBeaconServer.get().getPort()),
new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.CONTROL_DOWN))));
null)));
return l;
}