feature: cloudcmd: prevent unselect being fired on panel click when in mobile view (#422)

* Prevent unselect being fired on panel click when in mobile view

* Prevent unselect being fired on panel click when in mobile view after review

---------

Co-authored-by: hagaygo <hagay@WORKROOM>
This commit is contained in:
Hagay Goshen 2024-10-30 22:34:39 +02:00 committed by GitHub
parent 1a0af863a2
commit f22120dc38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -60,6 +60,7 @@ function CloudCmdProto(DOM) {
this.prefixURL = '';
this.MIN_ONE_PANEL_WIDTH = 1155;
this.MOBILE_ONE_PANEL_WIDTH = 600;
this.HOST = location.origin || location.protocol + '//' + location.host;
this.TITLE = 'Cloud Commander';

View file

@ -55,7 +55,7 @@ const {Events} = DOM;
const EventsFiles = {
mousedown: exec.with(execIfNotUL, setCurrentFileByEvent),
click: execAll([onClick, unselect]),
click: execAll([onClick, exec.with(execIfNotMobile, unselect)]),
dragstart: exec.with(execIfNotUL, onDragStart),
dblclick: exec.with(execIfNotUL, onDblClick),
touchstart: exec.with(execIfNotUL, onTouch),
@ -221,6 +221,12 @@ function copyPath(el) {
.catch(CloudCmd.log);
}
function execIfNotMobile(callback , event)
{
if (window.innerWidth > CloudCmd.MOBILE_ONE_PANEL_WIDTH)
callback(event);
}
function execIfNotUL(callback, event) {
const {target} = event;
const {tagName} = target;