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

Side by Side Diff: chrome/browser/resources/bookmark_manager/js/cr/ui/listselectionmodel.js

Issue 1225001: Add multiple item selection to BMM on mac (Closed)
Patch Set: Handle on mouseDown on mac Created 10 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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('cr.ui', function() { 5 cr.define('cr.ui', function() {
6 const Event = cr.Event; 6 const Event = cr.Event;
7 const EventTarget = cr.EventTarget; 7 const EventTarget = cr.EventTarget;
8 8
9 /** 9 /**
10 * Creates a new selection model that is to be used with lists. This is 10 * Creates a new selection model that is to be used with lists. This is
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 */ 106 */
107 handleMouseDownUp: function(e, item) { 107 handleMouseDownUp: function(e, item) {
108 var anchorItem = this.anchorItem; 108 var anchorItem = this.anchorItem;
109 109
110 this.beginChange_(); 110 this.beginChange_();
111 111
112 if (!item && !e.ctrlKey && !e.shiftKey && !e.metaKey) { 112 if (!item && !e.ctrlKey && !e.shiftKey && !e.metaKey) {
113 this.clear(); 113 this.clear();
114 } else { 114 } else {
115 var isDown = e.type == 'mousedown'; 115 var isDown = e.type == 'mousedown';
116 if (!cr.isMac && e.ctrlKey) { 116 if (cr.isMac ? e.metaKey : e.ctrlKey) {
117 // Handle ctrlKey on mouseup 117 // Selection is handled at mouseUp on windows/linux, mouseDown on mac.
118 if (!isDown) { 118 if (cr.isMac? isDown : !isDown) {
119 // toggle the current one and make it anchor item 119 // toggle the current one and make it anchor item
120 this.setItemSelected(item, !this.getItemSelected(item)); 120 this.setItemSelected(item, !this.getItemSelected(item));
121 this.leadItem = item; 121 this.leadItem = item;
122 this.anchorItem = item; 122 this.anchorItem = item;
123 } 123 }
124 } else if (e.shiftKey && anchorItem && anchorItem != item) { 124 } else if (e.shiftKey && anchorItem && anchorItem != item) {
125 // Shift is done in mousedown 125 // Shift is done in mousedown
126 if (isDown) { 126 if (isDown) {
127 this.clearAllSelected_(); 127 this.clearAllSelected_();
128 this.leadItem = item; 128 this.leadItem = item;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 * The leadItem is used with multiple selection and it is the item that the 433 * The leadItem is used with multiple selection and it is the item that the
434 * user is moving uysing the arrow keys. 434 * user is moving uysing the arrow keys.
435 * @type {*} 435 * @type {*}
436 */ 436 */
437 cr.defineProperty(ListSelectionModel, 'leadItem', cr.PropertyKind.JS, null); 437 cr.defineProperty(ListSelectionModel, 'leadItem', cr.PropertyKind.JS, null);
438 438
439 return { 439 return {
440 ListSelectionModel: ListSelectionModel 440 ListSelectionModel: ListSelectionModel
441 }; 441 };
442 }); 442 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698