mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-20 14:39:33 -04:00
Support mouse buttons for navigation
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user