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 { final class FileListComp extends AnchorPane {
private static final PseudoClass HIDDEN = PseudoClass.getPseudoClass("hidden"); 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 FOLDER = PseudoClass.getPseudoClass("folder");
private static final PseudoClass DRAG = PseudoClass.getPseudoClass("drag"); private static final PseudoClass DRAG = PseudoClass.getPseudoClass("drag");
private static final PseudoClass DRAG_OVER = PseudoClass.getPseudoClass("drag-over"); 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.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) -> { fileList.getDraggedOverDirectory().addListener((observable, oldValue, newValue) -> {
row.pseudoClassStateChanged(DRAG_OVER, newValue != null && newValue == row.getItem()); row.pseudoClassStateChanged(DRAG_OVER, newValue != null && newValue == row.getItem());
}); });

View file

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

View file

@ -5,6 +5,7 @@ import io.sentry.protocol.SentryId;
import io.sentry.protocol.User; import io.sentry.protocol.User;
import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppCache;
import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppProperties;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.XPipeDistributionType; import io.xpipe.app.util.XPipeDistributionType;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -86,6 +87,7 @@ public class SentryErrorHandler {
.toList(); .toList();
atts.forEach(attachment -> s.addAttachment(attachment)); 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("terminal", Boolean.toString(ee.isTerminal()));
s.setTag("omitted", Boolean.toString(ee.isOmitted())); s.setTag("omitted", Boolean.toString(ee.isOmitted()));
if (ee.getThrowable() != null) { 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 useSystemFont=Use system font
updates=Updates updates=Updates
advanced=Advanced 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 tooltipDelay=Tooltip delay
tooltipDelayDescription=The amount of milliseconds to wait until a tooltip is displayed. tooltipDelayDescription=The amount of milliseconds to wait until a tooltip is displayed.
fontSize=Font size fontSize=Font size

View file

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