diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-10-01 12:16:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 12:16:01 +0200 |
commit | e46159ab4d0300ca514121f7844888bbfe4a8875 (patch) | |
tree | 431748534d482dad710d36296727852604c4160e /platform/iphone | |
parent | 894b0a010bd3617ae09baa3b571d60154b9877e1 (diff) | |
parent | 1d9b6b01db4abbdd59651469f7917f97096cf771 (diff) |
Merge pull request #42454 from naithar/feature/ios-delay-in-settings-master
[4.0] [iOS] Add touch delay value to project settings
Diffstat (limited to 'platform/iphone')
-rw-r--r-- | platform/iphone/SCsub | 2 | ||||
-rw-r--r-- | platform/iphone/godot_view_gesture_recognizer.h | 2 | ||||
-rw-r--r-- | platform/iphone/godot_view_gesture_recognizer.mm (renamed from platform/iphone/godot_view_gesture_recognizer.m) | 15 |
3 files changed, 14 insertions, 5 deletions
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub index 49c77468ed..848fd9713a 100644 --- a/platform/iphone/SCsub +++ b/platform/iphone/SCsub @@ -18,7 +18,7 @@ iphone_lib = [ "godot_view.mm", "display_layer.mm", "godot_view_renderer.mm", - "godot_view_gesture_recognizer.m", + "godot_view_gesture_recognizer.mm", ] env_ios = env.Clone() diff --git a/platform/iphone/godot_view_gesture_recognizer.h b/platform/iphone/godot_view_gesture_recognizer.h index 8d84914712..1431a9fb89 100644 --- a/platform/iphone/godot_view_gesture_recognizer.h +++ b/platform/iphone/godot_view_gesture_recognizer.h @@ -39,6 +39,8 @@ @interface GodotViewGestureRecognizer : UIGestureRecognizer +@property(nonatomic, readonly, assign) NSTimeInterval delayTimeInterval; + - (instancetype)init; @end diff --git a/platform/iphone/godot_view_gesture_recognizer.m b/platform/iphone/godot_view_gesture_recognizer.mm index 377ccd52a5..99ee42ecb3 100644 --- a/platform/iphone/godot_view_gesture_recognizer.m +++ b/platform/iphone/godot_view_gesture_recognizer.mm @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godot_view_gesture_recognizer.m */ +/* godot_view_gesture_recognizer.mm */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -30,8 +30,7 @@ #import "godot_view_gesture_recognizer.h" -// Using same delay interval that is used for `UIScrollView` -const NSTimeInterval kGLGestureDelayInterval = 0.150; +#include "core/project_settings.h" // Minimum distance for touches to move to fire // a delay timer before scheduled time. @@ -41,6 +40,12 @@ const CGFloat kGLGestureMovementDistance = 0.5; @interface GodotViewGestureRecognizer () +@property(nonatomic, readwrite, assign) NSTimeInterval delayTimeInterval; + +@end + +@interface GodotViewGestureRecognizer () + // Timer used to delay begin touch message. // Should work as simple emulation of UIDelayedAction @property(strong, nonatomic) NSTimer *delayTimer; @@ -60,6 +65,8 @@ const CGFloat kGLGestureMovementDistance = 0.5; self.delaysTouchesBegan = YES; self.delaysTouchesEnded = YES; + self.delayTimeInterval = GLOBAL_GET("input_devices/pointing/ios/touch_delay"); + return self; } @@ -87,7 +94,7 @@ const CGFloat kGLGestureMovementDistance = 0.5; self.delayedEvent = event; self.delayTimer = [NSTimer - scheduledTimerWithTimeInterval:kGLGestureDelayInterval + scheduledTimerWithTimeInterval:self.delayTimeInterval target:self selector:@selector(fireDelayedTouches:) userInfo:nil |