mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
iOS: move touch delay to settings
This commit is contained in:
parent
894b0a010b
commit
1d9b6b01db
@ -555,6 +555,9 @@
|
||||
<member name="input_devices/pointing/emulate_touch_from_mouse" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], sends touch input events when clicking or dragging the mouse.
|
||||
</member>
|
||||
<member name="input_devices/pointing/ios/touch_delay" type="float" setter="" getter="" default="0.150">
|
||||
Default delay for touch events. This only affects iOS devices.
|
||||
</member>
|
||||
<member name="layer_names/2d_physics/layer_1" type="String" setter="" getter="" default="""">
|
||||
Optional name for the 2D physics layer 1.
|
||||
</member>
|
||||
|
@ -1369,6 +1369,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
"0,33200,1,or_greater")); // No negative numbers
|
||||
|
||||
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
|
||||
GLOBAL_DEF("input_devices/pointing/ios/touch_delay", 0.150);
|
||||
|
||||
Engine::get_singleton()->set_frame_delay(frame_delay);
|
||||
|
||||
|
@ -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()
|
||||
|
@ -39,6 +39,8 @@
|
||||
|
||||
@interface GodotViewGestureRecognizer : UIGestureRecognizer
|
||||
|
||||
@property(nonatomic, readonly, assign) NSTimeInterval delayTimeInterval;
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
@end
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user