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

Unified Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2972633002: [MD Bookmarks] Add UI for multi-item drag and drop chip. (Closed)
Patch Set: address comments Created 3 years, 5 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
Index: chrome/browser/resources/md_bookmarks/dnd_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/dnd_manager.js b/chrome/browser/resources/md_bookmarks/dnd_manager.js
index 587a452311ea97e728fdf02187e5aead2ac76a69..c1a73839400886e8906400459932b78e08739b04 100644
--- a/chrome/browser/resources/md_bookmarks/dnd_manager.js
+++ b/chrome/browser/resources/md_bookmarks/dnd_manager.js
@@ -295,6 +295,12 @@ cr.define('bookmarks', function() {
* @private {BookmarksDndChipElement}
*/
this.chip_ = null;
+
+ /**
+ * The element that initiated a drag.
+ * @private {BookmarkElement}
+ */
+ this.dragElement_ = null;
}
DNDManager.prototype = {
@@ -394,6 +400,7 @@ cr.define('bookmarks', function() {
/** @private */
clearDragData_: function() {
this.dndChip.hide();
+ this.dragElement_ = null;
// Defer the clearing of the data so that the bookmark manager API's drop
// event doesn't clear the drop data before the web drop event has a
@@ -416,6 +423,7 @@ cr.define('bookmarks', function() {
var store = bookmarks.Store.getInstance();
var dragId = dragElement.itemId;
+ this.dragElement_ = dragElement;
// Determine the selected bookmarks.
var state = store.data;
@@ -489,11 +497,13 @@ cr.define('bookmarks', function() {
if (!this.dragInfo_.isDragValid())
return;
+ var state = bookmarks.Store.getInstance().data;
+ var items = this.dragInfo_.dragData.elements.map(function(x) {
+ return bookmarks.util.normalizeNode(x);
+ });
this.dndChip.showForItems(
- e.clientX, e.clientY,
- this.dragInfo_.dragData.elements.map(function(x) {
- return bookmarks.util.normalizeNode(x);
- }));
+ e.clientX, e.clientY, items,
+ this.dragElement_ ? state.nodes[this.dragElement_.itemId] : items[0]);
var overElement = getBookmarkElement(e.path);
this.autoExpander_.update(e, overElement);

Powered by Google App Engine
This is Rietveld 408576698