Skip to content

Commit 2abd20c

Browse files
committed
Multiselect only on ctrl press
1 parent 6cd6b70 commit 2abd20c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/core/fm/content/item/index.jsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ export default class Item extends Component {
1717
return "item " + this.props.className;
1818
};
1919

20-
onClick = () => {
20+
onClick = (e) => {
2121
if(TIMER !== null) {
2222
return this.runDoubleClick();
2323
}
24-
TIMER = setTimeout(this.runSingleClick, 300);
24+
const multi = e.ctrlKey;
25+
TIMER = setTimeout(()=>this.runSingleClick(multi), 300);
2526
};
2627

27-
runSingleClick = () => {
28+
runSingleClick = (multi) => {
2829
this.killTimer();
29-
this.select();
30+
this.select(multi);
3031
};
3132

3233
runDoubleClick = () => {
@@ -51,9 +52,14 @@ export default class Item extends Component {
5152
}
5253
};
5354

54-
select = () => {
55+
select = (multi) => {
5556
let item = this.props.item;
5657

58+
if(!multi) {
59+
this.props.store.config.data.folders.forEach(folder=>{folder.selected=false;})
60+
this.props.store.config.data.files.forEach(file=>{file.selected=false;})
61+
}
62+
5763
if (item.is_dir) {
5864
item = this.props.store.config.data.folders.find(x => x === item);
5965
} else {

0 commit comments

Comments
 (0)