Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager.js

Issue 307863003: Listen to 'drag' to detect actual start of drag operation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified handler name to avoid confusion. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/drag_selector.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_manager.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js
index b10acca332bdb78eef3fc7966229bffe7d80e9df..e3465463bb41fea7098e0418695e56bf2043069d 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -999,15 +999,21 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
this.table_.list.addEventListener('focus', fileListFocusBound);
this.grid_.addEventListener('focus', fileListFocusBound);
- var dragStartBound = this.onDragStart_.bind(this);
- this.table_.list.addEventListener('dragstart', dragStartBound);
- this.grid_.addEventListener('dragstart', dragStartBound);
-
+ var draggingBound = this.onDragging_.bind(this);
var dragEndBound = this.onDragEnd_.bind(this);
+
+ // Listen to drag events to hide preview panel while user is dragging files.
+ // Files.app prevents default actions in 'dragstart' in some situations,
+ // so we listen to 'drag' to know the list is actually being dragged.
+ this.table_.list.addEventListener('drag', draggingBound);
+ this.grid_.addEventListener('drag', draggingBound);
this.table_.list.addEventListener('dragend', dragEndBound);
this.grid_.addEventListener('dragend', dragEndBound);
- // This event is published by DragSelector because drag end event is not
- // published at the end of drag selection.
+
+ // Listen to dragselection events to hide preview panel while the user is
+ // selecting files by drag operation.
+ this.table_.list.addEventListener('dragselectionstart', draggingBound);
+ this.grid_.addEventListener('dragselectionstart', draggingBound);
this.table_.list.addEventListener('dragselectionend', dragEndBound);
this.grid_.addEventListener('dragselectionend', dragEndBound);
@@ -1403,10 +1409,11 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
};
/**
- * Invoked when the drag is started on the list or the grid.
+ * Invoked while the drag is being performed on the list or the grid.
+ * Note: this method may be called multiple times before onDragEnd_().
* @private
*/
- FileManager.prototype.onDragStart_ = function() {
+ FileManager.prototype.onDragging_ = function() {
// On open file dialog, the preview panel is always shown.
if (DialogType.isOpenDialog(this.dialogType))
return;
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/drag_selector.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698