Skip to content

Commit 1d41566

Browse files
author
Florian
committed
added an iOS workaround for long-press through swipe-area
1 parent 1a3540b commit 1d41566

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

www/scripts/sepiaFW.ui.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,16 @@ function sepiaFW_build_ui(){
11531153
var resetTimer;
11541154
$swipeArea.mouseup(function(event){ up(this, event);
11551155
}).mousedown(function(event){ down(this, event);
1156-
//}).on('touchstart', function(event){ console.log('touchstart'); down(this, event);
1156+
//}).on('touchstart', function(event){ console.log('touchstart');
11571157
//}).on('touchend', function(event){ console.log('touchend'); up(this, event);
11581158
});
1159+
if (UI.isIOS){
1160+
$swipeArea.on('touchstart', function(event){ touchdown(this, event); });
1161+
}
1162+
function touchdown(that, ev){
1163+
//console.log('touchstart');
1164+
timeDown = new Date().getTime();
1165+
}
11591166
function down(that, ev){
11601167
//console.log('down');
11611168
if (!didDown){
@@ -1164,7 +1171,9 @@ function sepiaFW_build_ui(){
11641171
xDown = (ev.center)? ev.center.x : ev.clientX;
11651172
yDown = (ev.center)? ev.center.y : ev.clientY;
11661173
$(that).addClass('sepiaFW-fullSize');
1167-
timeDown = new Date().getTime();
1174+
if (!timeDown){
1175+
timeDown = new Date().getTime();
1176+
}
11681177
//console.log(ev);
11691178
timeDownTimer = setTimeout(function(){
11701179
up(that, ev); //note: ev will not be up-to-date here
@@ -1182,6 +1191,7 @@ function sepiaFW_build_ui(){
11821191
didDown = false;
11831192
}, 500);
11841193
}
1194+
timeDown = 0;
11851195
}
11861196
function checkClick(ev){
11871197
xUp = (ev.center)? ev.center.x : ev.clientX;

0 commit comments

Comments
 (0)