[gnome-shell/gbsneto/icon-grid-dnd: 2/18] folderIcon: Add visual drag-over feedback



commit cf43a8a3a4adac602d87476870e5c3d8a5ec3aad
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 7c363894e..a17a66917 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]