Improve drag and drop styling in file browser

This commit is contained in:
crschnick 2023-04-08 10:19:54 +00:00
parent 005bba4542
commit d9a18daed5
5 changed files with 14 additions and 11 deletions

View file

@ -42,6 +42,8 @@ import static javafx.scene.control.TableColumn.SortType.ASCENDING;
final class FileListComp extends AnchorPane {
private static final PseudoClass HIDDEN = PseudoClass.getPseudoClass("hidden");
private static final PseudoClass EMPTY = PseudoClass.getPseudoClass("empty");
private static final PseudoClass FILE = PseudoClass.getPseudoClass("file");
private static final PseudoClass FOLDER = PseudoClass.getPseudoClass("folder");
private static final PseudoClass DRAG = PseudoClass.getPseudoClass("drag");
private static final PseudoClass DRAG_OVER = PseudoClass.getPseudoClass("drag-over");
@ -186,6 +188,12 @@ final class FileListComp extends AnchorPane {
row.pseudoClassStateChanged(DRAG_OVER, false);
});
row.itemProperty().addListener((observable, oldValue, newValue) -> {
row.pseudoClassStateChanged(EMPTY, newValue == null);
row.pseudoClassStateChanged(FILE, newValue != null && !newValue.isDirectory());
row.pseudoClassStateChanged(FOLDER, newValue != null && newValue.isDirectory());
});
fileList.getDraggedOverDirectory().addListener((observable, oldValue, newValue) -> {
row.pseudoClassStateChanged(DRAG_OVER, newValue != null && newValue == row.getItem());
});

View file

@ -166,11 +166,8 @@ public class FileListCompEntry {
}
private void acceptDrag(DragEvent event) {
if (item == null || !item.isDirectory()) {
model.getDraggedOverEmpty().setValue(true);
} else {
model.getDraggedOverDirectory().setValue(item);
}
model.getDraggedOverEmpty().setValue(item == null || !item.isDirectory());
model.getDraggedOverDirectory().setValue(item);
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
}

View file

@ -5,6 +5,7 @@ import io.sentry.protocol.SentryId;
import io.sentry.protocol.User;
import io.xpipe.app.core.AppCache;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.XPipeDistributionType;
import org.apache.commons.io.FileUtils;
@ -86,6 +87,7 @@ public class SentryErrorHandler {
.toList();
atts.forEach(attachment -> s.addAttachment(attachment));
s.setTag("developerMode", AppPrefs.get() != null ? AppPrefs.get().developerMode().getValue().toString() : "false");
s.setTag("terminal", Boolean.toString(ee.isTerminal()));
s.setTag("omitted", Boolean.toString(ee.isOmitted()));
if (ee.getThrowable() != null) {

View file

@ -7,7 +7,7 @@ editorProgramDescription=The default text editor to use when editing any kind of
useSystemFont=Use system font
updates=Updates
advanced=Advanced
useSystemFontDescription=In case you're using a custom font on your system, you can opt to use it instead of the default X-Pipe font.
useSystemFontDescription=Controls whether to use your system font or the default font used by X-Pipe (Roboto).
tooltipDelay=Tooltip delay
tooltipDelayDescription=The amount of milliseconds to wait until a tooltip is displayed.
fontSize=Font size

View file

@ -54,15 +54,11 @@
-fx-opacity: 0.75;
}
.browser .table-directory-view .table-view:drag-into-current {
-fx-background-color: -color-success-muted;
}
.browser .table-directory-view .table-view:drag-into-current .table-row-cell {
-fx-opacity: 0.8;
}
.browser .table-row-cell:drag-over {
.browser .table-row-cell:folder:drag-over {
-fx-background-color: -color-success-muted;
}