You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/10/27 00:10:39 UTC
ios commit: CB-9685 A fix for the magnifying glass popping up on iOS9
when longpressing the webview. This is now disabled by default and can be
enabled for longpress in config.xml: and al
Repository: cordova-ios
Updated Branches:
refs/heads/master 3a15bed0e -> 1ad9951c8
CB-9685 A fix for the magnifying glass popping up on iOS9 when longpressing the webview. This is now disabled by default and can be enabled for longpress in config.xml:
<preference name="SuppressesLongPressGesture" value="true" />
and also for 3D Touch:
<preference name="Suppresses3DTouchGesture" value="true" />
note that if the former is true, the latter is ignored
This closes #174
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/1ad9951c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/1ad9951c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/1ad9951c
Branch: refs/heads/master
Commit: 1ad9951c80dbf97281e763f5f27a9bc8852c0537
Parents: 3a15bed
Author: EddyVerbruggen <ed...@gmail.com>
Authored: Sat Oct 24 08:41:07 2015 +0200
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Oct 26 16:16:10 2015 -0700
----------------------------------------------------------------------
.../Plugins/CDVGestureHandler/CDVGestureHandler.m | 16 +++++++++++++++-
bin/templates/project/__PROJECT_NAME__/config.xml | 2 ++
bin/templates/scripts/cordova/defaults.xml | 2 ++
tests/CordovaLibTests/CordovaLibApp/config.xml | 2 ++
4 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1ad9951c/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m b/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m
index a1b596b..242ac55 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m
@@ -28,10 +28,24 @@
- (void)applyLongPressFix
{
+ // You can't suppress 3D Touch and still have regular longpress,
+ // so if this is false, let's not consider the 3D Touch setting at all.
+ if (![self.commandDelegate.settings objectForKey:@"suppresseslongpressgesture"] ||
+ ![[self.commandDelegate.settings objectForKey:@"suppresseslongpressgesture"] boolValue]) {
+ return;
+ }
+
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.05f;
+ }
+
NSArray *views = self.webView.subviews;
if (views.count == 0) {
NSLog(@"No webview subviews found, not applying the longpress fix.");
@@ -52,7 +66,7 @@
{
if ([sender isEqual:self.lpgr]) {
if (sender.state == UIGestureRecognizerStateBegan) {
- NSLog(@"Ignoring a longpress in order to suppress the magnifying glass.");
+ NSLog(@"Ignoring a longpress in order to suppress the magnifying glass.");
}
}
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1ad9951c/bin/templates/project/__PROJECT_NAME__/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/config.xml b/bin/templates/project/__PROJECT_NAME__/config.xml
index 26919d0..96a1d42 100644
--- a/bin/templates/project/__PROJECT_NAME__/config.xml
+++ b/bin/templates/project/__PROJECT_NAME__/config.xml
@@ -55,6 +55,8 @@
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
+ <preference name="SuppressesLongPressGesture" value="false" />
+ <preference name="Suppresses3DTouchGesture" value="false" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" /> <!-- page, column -->
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1ad9951c/bin/templates/scripts/cordova/defaults.xml
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/defaults.xml b/bin/templates/scripts/cordova/defaults.xml
index 3e3cf2a..f1c3e37 100644
--- a/bin/templates/scripts/cordova/defaults.xml
+++ b/bin/templates/scripts/cordova/defaults.xml
@@ -29,6 +29,8 @@
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
+ <preference name="SuppressesLongPressGesture" value="false" />
+ <preference name="Suppresses3DTouchGesture" value="false" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" /> <!-- page, column -->
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1ad9951c/tests/CordovaLibTests/CordovaLibApp/config.xml
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CordovaLibApp/config.xml b/tests/CordovaLibTests/CordovaLibApp/config.xml
index 567fee8..6d48e7b 100644
--- a/tests/CordovaLibTests/CordovaLibApp/config.xml
+++ b/tests/CordovaLibTests/CordovaLibApp/config.xml
@@ -43,6 +43,8 @@
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
+ <preference name="SuppressesLongPressGesture" value="true" />
+ <preference name="Suppresses3DTouchGesture" value="false" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" /> <!-- page, column -->
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org