Skip to content

Commit f22120d

Browse files
hagaygohagaygo
andauthored
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>
1 parent 1a0af86 commit f22120d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

client/client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function CloudCmdProto(DOM) {
6060
this.prefixURL = '';
6161

6262
this.MIN_ONE_PANEL_WIDTH = 1155;
63+
this.MOBILE_ONE_PANEL_WIDTH = 600;
6364
this.HOST = location.origin || location.protocol + '//' + location.host;
6465

6566
this.TITLE = 'Cloud Commander';

client/listeners/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const {Events} = DOM;
5555

5656
const EventsFiles = {
5757
mousedown: exec.with(execIfNotUL, setCurrentFileByEvent),
58-
click: execAll([onClick, unselect]),
58+
click: execAll([onClick, exec.with(execIfNotMobile, unselect)]),
5959
dragstart: exec.with(execIfNotUL, onDragStart),
6060
dblclick: exec.with(execIfNotUL, onDblClick),
6161
touchstart: exec.with(execIfNotUL, onTouch),
@@ -221,6 +221,12 @@ function copyPath(el) {
221221
.catch(CloudCmd.log);
222222
}
223223

224+
function execIfNotMobile(callback , event)
225+
{
226+
if (window.innerWidth > CloudCmd.MOBILE_ONE_PANEL_WIDTH)
227+
callback(event);
228+
}
229+
224230
function execIfNotUL(callback, event) {
225231
const {target} = event;
226232
const {tagName} = target;

0 commit comments

Comments
 (0)