Support mouse buttons for navigation

This commit is contained in:
crschnick
2024-11-21 16:28:17 +00:00
parent 66b6fae017
commit e9be54f015
2 changed files with 23 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
package io.xpipe.app.browser.file;
import io.xpipe.app.browser.BrowserFullSessionModel;
import io.xpipe.app.util.BooleanScope;
import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.store.FileKind;
import javafx.geometry.Point2D;
@@ -54,6 +56,26 @@ public class BrowserFileListCompEntry {
return;
}
if (t.getButton() == MouseButton.BACK) {
ThreadHelper.runFailableAsync(() -> {
BooleanScope.executeExclusive(model.getFileSystemModel().getBusy(), () -> {
model.getFileSystemModel().backSync(1);
});
});
t.consume();
return;
}
if (t.getButton() == MouseButton.FORWARD) {
ThreadHelper.runFailableAsync(() -> {
BooleanScope.executeExclusive(model.getFileSystemModel().getBusy(), () -> {
model.getFileSystemModel().forthSync(1);
});
});
t.consume();
return;
}
if (item == null) {
// Only clear for normal clicks
if (t.isStillSincePress()) {

View File

@@ -64,13 +64,9 @@ public final class BrowserFileSystemHistory {
return history.get(cursor.get());
}
public String forth() {
return forth(1);
}
public String forth(int i) {
if (!canGoForth.get()) {
return null;
return history.getLast();
}
cursor.set(Math.min(history.size() - 1, cursor.get() + i));
return history.get(cursor.get());