Skip to content

Commit

Permalink
feature: cloudcmd: prevent unselect being fired on panel click when i…
Browse files Browse the repository at this point in the history
…n 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>
  • Loading branch information
hagaygo and hagaygo authored Oct 30, 2024
1 parent 1a0af86 commit f22120d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
8 changes: 7 additions & 1 deletion client/listeners/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f22120d

Please sign in to comment.