Web: Files: fix tile check logic

This commit is contained in:
Viktor Fomin 2022-05-27 13:04:38 +03:00
parent e6e7afd1f7
commit a7c5e5cb5e
2 changed files with 15 additions and 5 deletions

View File

@ -40,6 +40,7 @@ const FileTile = (props) => {
getContextModel,
onHideContextMenu,
thumbSize,
setSelection,
} = props;
const temporaryExtension =
@ -103,6 +104,7 @@ const FileTile = (props) => {
: t("Translations:TitleShowActions")
}
showHotkeyBorder={showHotkeyBorder}
setSelection={setSelection}
>
<FilesTileContent
item={item}
@ -116,9 +118,11 @@ const FileTile = (props) => {
);
};
export default inject(({ settingsStore }) => {
export default inject(({ settingsStore, filesStore }) => {
const { getIcon } = settingsStore;
return { getIcon };
const { setSelection } = filesStore;
return { getIcon, setSelection };
})(
withTranslation(["Home", "InfoPanel"])(
withRouter(

View File

@ -371,9 +371,15 @@ class Tile extends React.PureComponent {
onSelect && onSelect(true, item);
};
onFileClick = () => {
const { onSelect, item, checked } = this.props;
onSelect && onSelect(!checked, item);
onFileClick = (e) => {
const { onSelect, item, checked, setSelection } = this.props;
if (e.target.nodeName === "INPUT" || e.target.nodeName === "rect") {
onSelect && onSelect(!checked, item);
} else {
setSelection && setSelection([]);
onSelect && onSelect(!checked, item);
}
};
render() {