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

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

Issue 2888863002: [MD Bookmarks] Refine mouse selection (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_bookmarks/actions.js
diff --git a/chrome/browser/resources/md_bookmarks/actions.js b/chrome/browser/resources/md_bookmarks/actions.js
index 9f7800a123e1e77cc0ea7ac6664884858cda2030..95fe802e38a8f29f5c4e0ba587062f051e7b27bd 100644
--- a/chrome/browser/resources/md_bookmarks/actions.js
+++ b/chrome/browser/resources/md_bookmarks/actions.js
@@ -141,18 +141,20 @@ cr.define('bookmarks.actions', function() {
/**
* @param {string} id
- * @param {boolean} add
- * @param {boolean} range
* @param {BookmarksPageState} state
+ * @param {{add: boolean,
tsergeant 2017/05/18 23:13:37 `add` is a confusing name now, since if `add` is t
calamity 2017/05/19 06:46:56 #+1
+ range: boolean,
+ toggle: boolean,
+ updateAnchor: boolean}} config
tsergeant 2017/05/18 23:13:37 Every call site at the moment has `updateAnchor ==
calamity 2017/05/19 06:46:56 I thought I'd need special config for mouse vs key
* @return {!Action}
*/
- function selectItem(id, add, range, state) {
+ function selectItem(id, state, config) {
+ assert(!(config.range && config.toggle));
tsergeant 2017/05/18 23:13:37 toggle is a no-op unless add is true, so do you al
calamity 2017/05/19 06:46:56 Done.
+
var anchor = state.selection.anchor;
var toSelect = [];
- // TODO(tsergeant): Make it possible to deselect items by ctrl-clicking them
- // again.
- if (range && anchor) {
+ if (config.range && anchor) {
var displayedList = bookmarks.util.getDisplayedList(state);
var selectedIndex = displayedList.indexOf(id);
assert(selectedIndex != -1);
@@ -171,8 +173,9 @@ cr.define('bookmarks.actions', function() {
return {
name: 'select-items',
- add: add,
- anchor: id,
+ add: config.add,
+ toggle: config.toggle,
+ anchor: config.updateAnchor ? id : anchor,
items: toSelect,
};
}
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/dnd_manager.js » ('j') | chrome/browser/resources/md_bookmarks/item.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698