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

Side by Side Diff: chrome/browser/resources/md_bookmarks/dnd_chip.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'bookmarks-dnd-chip', 6 is: 'bookmarks-dnd-chip',
7 7
8 properties: { 8 properties: {
9 /** @private */ 9 /** @private */
10 showing_: { 10 showing_: {
11 type: Boolean, 11 type: Boolean,
12 reflectToAttribute: true, 12 reflectToAttribute: true,
13 }, 13 },
14 14
15 /** @private */ 15 /** @private */
16 isFolder_: Boolean, 16 isFolder_: Boolean,
17
18 /** @private */
19 isMultiItem_: Boolean,
17 }, 20 },
18 21
19 /** 22 /**
20 * @param {number} x 23 * @param {number} x
21 * @param {number} y 24 * @param {number} y
22 * @param {!Array<BookmarkNode>} items 25 * @param {!Array<BookmarkNode>} items
26 * @param {!BookmarkNode} dragItem
23 */ 27 */
24 showForItems: function(x, y, items) { 28 showForItems: function(x, y, items, dragItem) {
25 this.style.setProperty('--mouse-x', x + 'px'); 29 this.style.setProperty('--mouse-x', x + 'px');
26 this.style.setProperty('--mouse-y', y + 'px'); 30 this.style.setProperty('--mouse-y', y + 'px');
27 31
28 if (this.showing_) 32 if (this.showing_)
29 return; 33 return;
30 34
31 var firstItem = items[0]; 35 this.isFolder_ = !dragItem.url;
32 this.isFolder_ = !firstItem.url; 36 this.isMultiItem_ = items.length > 1;
33 // TODO(calamity): handle multi-item UI. 37 if (dragItem.url)
34 if (firstItem.url) 38 this.$.icon.style.backgroundImage = cr.icon.getFavicon(dragItem.url);
35 this.$.icon.style.backgroundImage = cr.icon.getFavicon(firstItem.url);
36 39
37 this.$.title.textContent = firstItem.title; 40 this.$.title.textContent = dragItem.title;
41 this.$.count.textContent = items.length;
38 this.showing_ = true; 42 this.showing_ = true;
39 }, 43 },
40 44
41 hide: function() { 45 hide: function() {
42 this.showing_ = false; 46 this.showing_ = false;
43 }, 47 },
44 }); 48 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698