From 52257f513703a1f36974850515ca6efdce0c0dcd Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 1 Jul 2019 21:37:35 -0300 Subject: [PATCH] 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 | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss index 5e377df15..8731ba48d 100644 --- a/data/theme/gnome-shell-sass/_common.scss +++ b/data/theme/gnome-shell-sass/_common.scss @@ -1514,6 +1514,9 @@ StScrollBar { border-image: none; background-image: none; } + &: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 8709d30de..9ff61ed95 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -1361,11 +1361,29 @@ var FolderIcon = class FolderIcon { } _onDragBegin() { + this._dragMonitor = { + dragMotion: this._onDragMotion.bind(this), + }; + DND.addDragMonitor(this._dragMonitor); + this._parentView.inhibitEventBlocker(); } + _onDragMotion(dragEvent) { + let target = dragEvent.targetActor; + + if (!this.actor.contains(target) || !this._canDropAt(dragEvent.source)) + 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) {