[gnome-shell/gbsneto/icon-grid-dnd: 47/47] folderIcon: Add visual drag-over feedback
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd: 47/47] folderIcon: Add visual drag-over feedback
- Date: Tue, 2 Jul 2019 00:43:13 +0000 (UTC)
commit eec6f52128fa7352161de1f82b8e2fe1f16de0f1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jul 1 21:37:35 2019 -0300
folderIcon: Add visual drag-over feedback
WIP: This is not exactly what was discussed on IRC, but
it's looking alright as a first iteration. Design feedback
welcomed.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603
data/theme/gnome-shell-sass/_common.scss | 3 +++
js/ui/appDisplay.js | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
---
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
index 0b38c9c53..188a9931d 100644
--- a/data/theme/gnome-shell-sass/_common.scss
+++ b/data/theme/gnome-shell-sass/_common.scss
@@ -1495,6 +1495,9 @@ StScrollBar {
& .overview-icon {
@extend %icon_tile;
}
+ &:drop > .overview-icon {
+ background-color: transparentize($selected_bg_color,.15);
+ }
&:active .overview-icon,
&:checked .overview-icon {
background-color: transparentize(darken($osd_bg_color,10%), 0.5);
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 1649eb644..35cca0a05 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1302,12 +1302,40 @@ var FolderIcon = class FolderIcon {
return this.view.getAllItems().map(item => item.id);
}
+ _isChild(actor) {
+ while (actor) {
+ if (actor == this.actor)
+ return true;
+ actor = actor.get_parent();
+ }
+
+ return false;
+ }
+
_onDragBegin() {
+ this._dragMonitor = {
+ dragMotion: this._onDragMotion.bind(this),
+ };
+ DND.addDragMonitor(this._dragMonitor);
+
this._parentView.inhibitEventBlocker();
}
+ _onDragMotion(dragEvent) {
+ let target = dragEvent.targetActor;
+
+ if (!this._isChild(target))
+ this.actor.remove_style_pseudo_class('drop');
+ else
+ this.actor.add_style_pseudo_class('drop');
+
+ return DND.DragMotionResult.CONTINUE;
+ }
+
_onDragEnd() {
+ this.actor.remove_style_pseudo_class('drop');
this._parentView.uninhibitEventBlocker();
+ DND.removeDragMonitor(this._dragMonitor);
}
_canDropAt(source) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]