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

Side by Side Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2888863002: [MD Bookmarks] Refine mouse selection (Closed)
Patch Set: address comments Created 3 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 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 cr.define('bookmarks', function() { 5 cr.define('bookmarks', function() {
6 /** 6 /**
7 * @param {BookmarkElement} element 7 * @param {BookmarkElement} element
8 * @return {boolean} 8 * @return {boolean}
9 */ 9 */
10 function isBookmarkItem(element) { 10 function isBookmarkItem(element) {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // Determine the selected bookmarks. 408 // Determine the selected bookmarks.
409 var state = store.data; 409 var state = store.data;
410 var draggedNodes = Array.from(state.selection.items); 410 var draggedNodes = Array.from(state.selection.items);
411 411
412 // Change selection to the dragged node if the node is not part of the 412 // Change selection to the dragged node if the node is not part of the
413 // existing selection. 413 // existing selection.
414 if (isBookmarkFolderNode(dragElement) || 414 if (isBookmarkFolderNode(dragElement) ||
415 draggedNodes.indexOf(dragId) == -1) { 415 draggedNodes.indexOf(dragId) == -1) {
416 store.dispatch(bookmarks.actions.deselectItems()); 416 store.dispatch(bookmarks.actions.deselectItems());
417 if (!isBookmarkFolderNode(dragElement)) { 417 if (!isBookmarkFolderNode(dragElement)) {
418 store.dispatch( 418 store.dispatch(bookmarks.actions.selectItem(dragId, state, {
419 bookmarks.actions.selectItem(dragId, true, false, state)); 419 clear: false,
420 range: false,
421 toggle: false,
422 }));
420 } 423 }
421 draggedNodes = [dragId]; 424 draggedNodes = [dragId];
422 } 425 }
423 426
424 e.preventDefault(); 427 e.preventDefault();
425 428
426 // If we are dragging a single link, we can do the *Link* effect. 429 // If we are dragging a single link, we can do the *Link* effect.
427 // Otherwise, we only allow copy and move. 430 // Otherwise, we only allow copy and move.
428 if (e.dataTransfer) { 431 if (e.dataTransfer) {
429 e.dataTransfer.effectAllowed = 432 e.dataTransfer.effectAllowed =
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 this.dropIndicator_.setTimeout = this.setTimeout_; 634 this.dropIndicator_.setTimeout = this.setTimeout_;
632 } 635 }
633 }; 636 };
634 637
635 return { 638 return {
636 DNDManager: DNDManager, 639 DNDManager: DNDManager,
637 DragInfo: DragInfo, 640 DragInfo: DragInfo,
638 DropIndicator: DropIndicator, 641 DropIndicator: DropIndicator,
639 }; 642 };
640 }); 643 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/actions.js ('k') | chrome/browser/resources/md_bookmarks/item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698