EddyVerbruggen / cordova-plugin-ios-longpress-fix

:mag: Suppress the magnifying glass when long pressing an iOS9 PhoneGap app
MIT License
67 stars 15 forks source link

All touches showing as Long Presses #10

Open kyleamadio opened 6 years ago

kyleamadio commented 6 years ago

Hi Eddy - not sure if this is something you can help with. I am seeing the dozens of these, especially on INPUT and TEXTAREA controls. The threshold seems too low. If I do the touch very quickly and lightly I don't see the Longpress message...

2018-02-27 13:20:17.934061+1100 magicalCordovaIOS[679:141683] Ignoring a longpress in order to suppress the magnifying glass. 2018-02-27 13:20:21.819026+1100 magicalCordovaIOS[679:141683] Ignoring a longpress in order to suppress the magnifying glass. 2018-02-27 13:20:23.201964+1100 magicalCordovaIOS[679:141683] Ignoring a longpress in order to suppress the magnifying glass.

Here is my Cordova info:

Node version: v9.5.0 Cordova version: 8.0.0

Config.xml file:

<?xml version='1.0' encoding='utf-8'?>

magicalCordovaIOS magical makes gift giving fun again. Magical Connect Pty Limited

Plugins:

cordova-plugin-browsertab,cordova-plugin-buildinfo,cordova-plugin-compat,cordova-plugin-dialogs,cordova-plugin-geolocation,cordova-plugin-ios-longpress-fix,cordova-plugin-network-information,cordova-plugin-splashscreen,cordova-plugin-whitelist

iOS platform:

Xcode 9.2 Build version 9C40b

kyleamadio commented 6 years ago

Eddy - I changed this and now touches on INPUT and TEXTAREA etc work as expected

self.lpgr.minimumPressDuration = 0.05f. to self.lpgr.minimumPressDuration = 0.95f

self.lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)];
self.lpgr.minimumPressDuration = 0.45f;
self.lpgr.allowableMovement = 100.0f;

// 0.45 is ok for 'regular longpress', 0.05-0.08 is required for '3D Touch longpress',
// but since this will also kill onclick handlers (not ontouchend) it's optional.
if ([self.commandDelegate.settings objectForKey:@"suppresses3dtouchgesture"] &&
    [[self.commandDelegate.settings objectForKey:@"suppresses3dtouchgesture"] boolValue]) {
    **self.lpgr.minimumPressDuration = 0.95f;**
}