Files.app: Introduce check-select mode.
Check-select mode spec is here: https://docs.google.com/document/d/1kCG0AFtZSlxlkuipNHlKLY2nvjPdDCViG6RKhMI5-dc/edit
Mode transition rules:
+ Entering check-select mode
- When two or more items are selected.
- When checkmark area is clicked.
+ Leaving check-select mode
- When all items are unselected.
- When non-checkmark area on an item is clicked.
- When direction key(UP,LEFT,etc...) results in single selection.
BUG=460220
TEST=manually tested
Committed: https://crrev.com/e144d30232209034b82d544926070bb8dc62f6ec
Cr-Commit-Position: refs/heads/master@{#318658}
5 years, 9 months ago
(2015-02-27 04:26:25 UTC)
#2
Could you take a look? Thank you!
fukino
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager/common/js/util.js File ui/file_manager/file_manager/common/js/util.js (left): https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager/common/js/util.js#oldcode1046 ui/file_manager/file_manager/common/js/util.js:1046: util.repeatMouseEventWithCtrlKey = function(target, event) { Now that we can ...
5 years, 9 months ago
(2015-02-27 04:28:26 UTC)
#3
5 years, 9 months ago
(2015-02-27 09:03:52 UTC)
#6
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
File ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js
(right):
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js:8: *
@extends {cr.ui.ListSelectionModel}
On 2015/02/27 06:43:52, fukino wrote:
> On 2015/02/27 05:45:46, hirono wrote:
> > Can we mark this constructor as @struct?
>
> structs can only extends structs, but cr.ui.ListSelectionModel is not
struct...
If possible, I prefer to use @suppress {checkStructDictInheritance} rather than
giving up all unknown property checks.
I wrote about it before at item #14.
https://docs.google.com/a/google.com/document/d/16VY9cRVNo4Hav2_ciIuRcdEZXfb7...
WDYT?
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js:53:
this.isCheckSelectMode_ = false;
On 2015/02/27 06:43:51, fukino wrote:
> On 2015/02/27 05:45:46, hirono wrote:
> > Why do we update the mode in dispatchEvent method?
>
> When redrawing file list, selectedIndexes can be 0 temporarily.
> In such case, it can occur that check-select mode is disabled unintentionally.
> To avoid updating mode between startChange() and endChange(), we wait
> dispatchEvent() which is triggered by endChange().
How about override endChange instead of dispatchEvent?
It sounds more suitable for the method names (endChange vs dispatchEvent).
5 years, 9 months ago
(2015-02-27 09:25:27 UTC)
#7
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
File ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js
(right):
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js:8: *
@extends {cr.ui.ListSelectionModel}
On 2015/02/27 09:03:52, hirono wrote:
> On 2015/02/27 06:43:52, fukino wrote:
> > On 2015/02/27 05:45:46, hirono wrote:
> > > Can we mark this constructor as @struct?
> >
> > structs can only extends structs, but cr.ui.ListSelectionModel is not
> struct...
>
> If possible, I prefer to use @suppress {checkStructDictInheritance} rather
than
> giving up all unknown property checks.
>
> I wrote about it before at item #14.
>
https://docs.google.com/a/google.com/document/d/16VY9cRVNo4Hav2_ciIuRcdEZXfb7...
>
> WDYT?
I've just remembered!
Done for FileListSelectionModel, FileListSingleSelectionModel,
FileListSelectionController, and FileGridSelectionController.
Thank you!
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js:53:
this.isCheckSelectMode_ = false;
On 2015/02/27 09:03:52, hirono wrote:
> On 2015/02/27 06:43:51, fukino wrote:
> > On 2015/02/27 05:45:46, hirono wrote:
> > > Why do we update the mode in dispatchEvent method?
> >
> > When redrawing file list, selectedIndexes can be 0 temporarily.
> > In such case, it can occur that check-select mode is disabled
unintentionally.
> > To avoid updating mode between startChange() and endChange(), we wait
> > dispatchEvent() which is triggered by endChange().
>
> How about override endChange instead of dispatchEvent?
> It sounds more suitable for the method names (endChange vs dispatchEvent).
To do it with endChange(), we need to access this.changeCount_. However, it is
private member and we shouldn't rely on it.
I don't think dispatchEvent is not suitable, because client-observable state
changes are strongly connected to the dispatchEvent. WDYT?
5 years, 9 months ago
(2015-02-27 09:49:59 UTC)
#8
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
File ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js
(right):
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js:53:
this.isCheckSelectMode_ = false;
On 2015/02/27 09:25:26, fukino wrote:
> On 2015/02/27 09:03:52, hirono wrote:
> > On 2015/02/27 06:43:51, fukino wrote:
> > > On 2015/02/27 05:45:46, hirono wrote:
> > > > Why do we update the mode in dispatchEvent method?
> > >
> > > When redrawing file list, selectedIndexes can be 0 temporarily.
> > > In such case, it can occur that check-select mode is disabled
> unintentionally.
> > > To avoid updating mode between startChange() and endChange(), we wait
> > > dispatchEvent() which is triggered by endChange().
> >
> > How about override endChange instead of dispatchEvent?
> > It sounds more suitable for the method names (endChange vs dispatchEvent).
>
> To do it with endChange(), we need to access this.changeCount_. However, it is
> private member and we shouldn't rely on it.
> I don't think dispatchEvent is not suitable, because client-observable state
> changes are strongly connected to the dispatchEvent. WDYT?
I think it causes a strange behavior like:
model.getCheckSelectMode(); // true
model.leadIndex = newValue;
model.getCheckSelectMode(); // false
If we cannot use endChange easily, how about filtering out the above case by
seeing event.type, or just adding event listener itself in the constructor to
update isCheckSelectMode_?
5 years, 9 months ago
(2015-03-02 03:51:07 UTC)
#9
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
File ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js
(right):
https://codereview.chromium.org/962103002/diff/1/ui/file_manager/file_manager...
ui/file_manager/file_manager/foreground/js/ui/file_list_selection_model.js:53:
this.isCheckSelectMode_ = false;
On 2015/02/27 09:49:59, hirono wrote:
> I think it causes a strange behavior like:
>
> model.getCheckSelectMode(); // true
> model.leadIndex = newValue;
> model.getCheckSelectMode(); // false
>
> If we cannot use endChange easily, how about filtering out the above case by
> seeing event.type, or just adding event listener itself in the constructor to
> update isCheckSelectMode_?
>
Ah, you're right! Thank you pointing this out.
What I wanted to do was "Update the mode based on selection count before
notifying changes of selected indexes". 'leadIndex' and 'anchorIndex' events
should have been filtered out.
Using event listeners to update isCheckSelectMode_ can make another complication
to deal with event dispatching order, so I've simply added filtering for event
type.
hirono
> Using event listeners to update isCheckSelectMode_ can make another complication > to deal with ...
5 years, 9 months ago
(2015-03-02 04:03:52 UTC)
#10
> Using event listeners to update isCheckSelectMode_ can make another
complication
> to deal with event dispatching order, so I've simply added filtering for event
> type.
EventTarget (or cr.EventTarget) ensures to call listeners in the same order that
the listeners were registered.
So if we add the listener in the constructor, we don't have to care about it.
fukino
On 2015/03/02 04:03:52, hirono wrote: > > Using event listeners to update isCheckSelectMode_ can make ...
5 years, 9 months ago
(2015-03-02 04:30:15 UTC)
#11
On 2015/03/02 04:03:52, hirono wrote:
> > Using event listeners to update isCheckSelectMode_ can make another
> complication
> > to deal with event dispatching order, so I've simply added filtering for
event
> > type.
>
> EventTarget (or cr.EventTarget) ensures to call listeners in the same order
that
> the listeners were registered.
> So if we add the listener in the constructor, we don't have to care about it.
I misunderstood the constructor you meant..
Adding listener to FileListSelectionModel makes sense. I modified it to use the
listener.
hirono
LGTM, thanks!
5 years, 9 months ago
(2015-03-02 05:15:01 UTC)
#12
LGTM, thanks!
fukino
Thank you!
5 years, 9 months ago
(2015-03-02 06:12:09 UTC)
#13
Thank you!
fukino
The CQ bit was checked by fukino@chromium.org
5 years, 9 months ago
(2015-03-02 06:12:18 UTC)
#14
Issue 962103002: Files.app: Introduce check-select mode.
(Closed)
Created 5 years, 9 months ago by fukino
Modified 5 years, 9 months ago
Reviewers: hirono
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 36