diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index efd5f77fe..ce7f22cd1 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -779,9 +779,6 @@
If [code]true[/code], sends touch input events when clicking or dragging the mouse.
-
- Default delay for touch events. This only affects iOS devices.
-
Optional name for the 2D navigation layer 1. If left empty, the layer will display as "Layer 1".
diff --git a/main/main.cpp b/main/main.cpp
index a2b345e03..ff6ad64cb 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1249,11 +1249,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
GLOBAL_DEF("display/window/ios/hide_status_bar", true);
GLOBAL_DEF("display/window/ios/suppress_ui_gesture", true);
- GLOBAL_DEF("input_devices/pointing/ios/touch_delay", 0.15);
- ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pointing/ios/touch_delay",
- PropertyInfo(Variant::REAL,
- "input_devices/pointing/ios/touch_delay",
- PROPERTY_HINT_RANGE, "0,1,0.001"));
Engine::get_singleton()->set_frame_delay(frame_delay);
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index d30f717ef..6b4624e83 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -14,7 +14,6 @@ iphone_lib = [
"display_layer.mm",
"pandemonium_app_delegate.m",
"pandemonium_view_renderer.mm",
- "pandemonium_view_gesture_recognizer.mm",
"device_metrics.m",
"keyboard_input_view.mm",
"native_video_view.m",
diff --git a/platform/iphone/pandemonium_view.h b/platform/iphone/pandemonium_view.h
index 87696c9af..b3b634378 100644
--- a/platform/iphone/pandemonium_view.h
+++ b/platform/iphone/pandemonium_view.h
@@ -65,9 +65,4 @@ class String;
@property(nonatomic, assign) BOOL useCADisplayLink;
-- (void)pandemoniumTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
-- (void)pandemoniumTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
-- (void)pandemoniumTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
-- (void)pandemoniumTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
-
@end
diff --git a/platform/iphone/pandemonium_view.mm b/platform/iphone/pandemonium_view.mm
index 89c32cab8..f6d1e3595 100644
--- a/platform/iphone/pandemonium_view.mm
+++ b/platform/iphone/pandemonium_view.mm
@@ -38,7 +38,6 @@
#import
#import "display_layer.h"
-#import "pandemonium_view_gesture_recognizer.h"
#import "pandemonium_view_renderer.h"
#import
@@ -62,8 +61,6 @@ static const int max_touches = 8;
@property(strong, nonatomic) CMMotionManager *motionManager;
-@property(strong, nonatomic) PandemoniumViewGestureRecognizer *delayGestureRecognizer;
-
@end
@implementation PandemoniumView
@@ -134,10 +131,6 @@ static const int max_touches = 8;
[self.animationTimer invalidate];
self.animationTimer = nil;
}
-
- if (self.delayGestureRecognizer) {
- self.delayGestureRecognizer = nil;
- }
}
- (void)pandemonium_commonInit {
@@ -157,11 +150,6 @@ static const int max_touches = 8;
self.motionManager = nil;
}
}
-
- // Initialize delay gesture recognizer
- PandemoniumViewGestureRecognizer *gestureRecognizer = [[PandemoniumViewGestureRecognizer alloc] init];
- self.delayGestureRecognizer = gestureRecognizer;
- [self addGestureRecognizer:self.delayGestureRecognizer];
}
- (void)startRendering {
@@ -333,75 +321,61 @@ static const int max_touches = 8;
}
}
-- (void)pandemoniumTouchesBegan:(NSSet *)touchesSet withEvent:(UIEvent *)event {
- NSArray *tlist = [event.allTouches allObjects];
- for (unsigned int i = 0; i < [tlist count]; i++) {
- if ([touchesSet containsObject:[tlist objectAtIndex:i]]) {
- UITouch *touch = [tlist objectAtIndex:i];
- int tid = [self getTouchIDForTouch:touch];
- ERR_FAIL_COND(tid == -1);
- CGPoint touchPoint = [touch locationInView:self];
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+ for (UITouch *touch in touches) {
+ int tid = [self getTouchIDForTouch:touch];
+ ERR_FAIL_COND(tid == -1);
+ CGPoint touchPoint = [touch locationInView:self];
- if (touch.type == UITouchTypeStylus) {
- OSIPhone::get_singleton()->pencil_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1);
- } else {
- OSIPhone::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1);
- }
+ if (touch.type == UITouchTypeStylus) {
+ OSIPhone::get_singleton()->pencil_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1);
+ } else {
+ OSIPhone::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1);
}
}
}
-- (void)pandemoniumTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- NSArray *tlist = [event.allTouches allObjects];
- for (unsigned int i = 0; i < [tlist count]; i++) {
- if ([touches containsObject:[tlist objectAtIndex:i]]) {
- UITouch *touch = [tlist objectAtIndex:i];
- int tid = [self getTouchIDForTouch:touch];
- ERR_FAIL_COND(tid == -1);
- CGPoint touchPoint = [touch locationInView:self];
- CGPoint prev_point = [touch previousLocationInView:self];
- CGFloat force = touch.force;
- // Vector2 tilt = touch.azimuthUnitVector;
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
+ for (UITouch *touch in touches) {
+ int tid = [self getTouchIDForTouch:touch];
+ ERR_FAIL_COND(tid == -1);
+ CGPoint touchPoint = [touch locationInView:self];
+ CGPoint prev_point = [touch previousLocationInView:self];
+ CGFloat force = touch.force;
- if (touch.type == UITouchTypeStylus) {
- OSIPhone::get_singleton()->pencil_drag(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, force);
- } else {
- OSIPhone::get_singleton()->touch_drag(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor);
- }
+ if (touch.type == UITouchTypeStylus) {
+ OSIPhone::get_singleton()->pencil_drag(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, force);
+ } else {
+ OSIPhone::get_singleton()->touch_drag(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor);
}
}
}
-- (void)pandemoniumTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- NSArray *tlist = [event.allTouches allObjects];
- for (unsigned int i = 0; i < [tlist count]; i++) {
- if ([touches containsObject:[tlist objectAtIndex:i]]) {
- UITouch *touch = [tlist objectAtIndex:i];
- int tid = [self getTouchIDForTouch:touch];
- ERR_FAIL_COND(tid == -1);
- [self removeTouch:touch];
- CGPoint touchPoint = [touch locationInView:self];
- if (touch.type == UITouchTypeStylus) {
- OSIPhone::get_singleton()->pencil_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false);
- } else {
- OSIPhone::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false);
- }
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+ for (UITouch *touch in touches) {
+ int tid = [self getTouchIDForTouch:touch];
+ ERR_FAIL_COND(tid == -1);
+ [self removeTouch:touch];
+
+ CGPoint touchPoint = [touch locationInView:self];
+
+ if (touch.type == UITouchTypeStylus) {
+ OSIPhone::get_singleton()->pencil_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false);
+ } else {
+ OSIPhone::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false);
}
}
}
-- (void)pandemoniumTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
- NSArray *tlist = [event.allTouches allObjects];
- for (unsigned int i = 0; i < [tlist count]; i++) {
- if ([touches containsObject:[tlist objectAtIndex:i]]) {
- UITouch *touch = [tlist objectAtIndex:i];
- int tid = [self getTouchIDForTouch:touch];
- ERR_FAIL_COND(tid == -1);
- if (touch.type == UITouchTypeStylus) {
- OSIPhone::get_singleton()->pencil_cancelled(tid);
- } else {
- OSIPhone::get_singleton()->touches_cancelled(tid);
- }
+- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
+ for (UITouch *touch in touches) {
+ int tid = [self getTouchIDForTouch:touch];
+ ERR_FAIL_COND(tid == -1);
+
+ if (touch.type == UITouchTypeStylus) {
+ OSIPhone::get_singleton()->pencil_cancelled(tid);
+ } else {
+ OSIPhone::get_singleton()->touches_cancelled(tid);
}
}
[self clearTouches];
diff --git a/platform/iphone/pandemonium_view_gesture_recognizer.h b/platform/iphone/pandemonium_view_gesture_recognizer.h
deleted file mode 100644
index d1cb30443..000000000
--- a/platform/iphone/pandemonium_view_gesture_recognizer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************/
-/* pandemonium_view_gesture_recognizer.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-// PandemoniumViewGestureRecognizer allows iOS gestures to work correctly by
-// emulating UIScrollView's UIScrollViewDelayedTouchesBeganGestureRecognizer.
-// It catches all gestures incoming to UIView and delays them for 150ms
-// (the same value used by UIScrollViewDelayedTouchesBeganGestureRecognizer)
-// If touch cancellation or end message is fired it fires delayed
-// begin touch immediately as well as last touch signal
-
-#import
-
-@interface PandemoniumViewGestureRecognizer : UIGestureRecognizer {
-@private
-
- // Timer used to delay begin touch message.
- // Should work as simple emulation of UIDelayedAction
- NSTimer *delayTimer;
-
- // Delayed touch parameters
- NSSet *delayedTouches;
- UIEvent *delayedEvent;
-}
-
-@property(nonatomic, readonly, assign) NSTimeInterval delayTimeInterval;
-
-- (instancetype)init;
-
-@end
diff --git a/platform/iphone/pandemonium_view_gesture_recognizer.mm b/platform/iphone/pandemonium_view_gesture_recognizer.mm
deleted file mode 100644
index f354c6def..000000000
--- a/platform/iphone/pandemonium_view_gesture_recognizer.mm
+++ /dev/null
@@ -1,152 +0,0 @@
-/*************************************************************************/
-/* pandemonium_view_gesture_recognizer.mm */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#import "pandemonium_view_gesture_recognizer.h"
-#import "pandemonium_view.h"
-
-#include "core/config/project_settings.h"
-
-// Minimum distance for touches to move to fire
-// a delay timer before scheduled time.
-// Should be the low enough to not cause issues with dragging
-// but big enough to allow click to work.
-const CGFloat kGLGestureMovementDistance = 0.5;
-
-@interface PandemoniumViewGestureRecognizer ()
-
-@property(nonatomic, readwrite, assign) NSTimeInterval delayTimeInterval;
-
-@end
-
-@implementation PandemoniumViewGestureRecognizer
-
-- (PandemoniumView *)pandemoniumView {
- return (PandemoniumView *)self.view;
-}
-
-- (instancetype)init {
- self = [super init];
-
- self.cancelsTouchesInView = YES;
- self.delaysTouchesBegan = YES;
- self.delaysTouchesEnded = YES;
- self.requiresExclusiveTouchType = NO;
-
- self.delayTimeInterval = GLOBAL_GET("input_devices/pointing/ios/touch_delay");
-
- return self;
-}
-
-- (void)delayTouches:(NSSet *)touches andEvent:(UIEvent *)event {
- [delayTimer fire];
-
- delayedTouches = touches;
- delayedEvent = event;
-
- delayTimer = [NSTimer scheduledTimerWithTimeInterval:self.delayTimeInterval target:self selector:@selector(fireDelayedTouches:) userInfo:nil repeats:NO];
-}
-
-- (void)fireDelayedTouches:(id)timer {
- [delayTimer invalidate];
- delayTimer = nil;
-
- if (delayedTouches) {
- [self.pandemoniumView pandemoniumTouchesBegan:delayedTouches withEvent:delayedEvent];
- }
-
- delayedTouches = nil;
- delayedEvent = nil;
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- NSSet *cleared = [self copyClearedTouches:touches phase:UITouchPhaseBegan];
- [self delayTouches:cleared andEvent:event];
-
- [super touchesBegan:touches withEvent:event];
-}
-
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- NSSet *cleared = [self copyClearedTouches:touches phase:UITouchPhaseMoved];
-
- if (delayTimer) {
- // We should check if movement was significant enough to fire an event
- // for dragging to work correctly.
- for (UITouch *touch in cleared) {
- CGPoint from = [touch locationInView:self.pandemoniumView];
- CGPoint to = [touch previousLocationInView:self.pandemoniumView];
- CGFloat xDistance = from.x - to.x;
- CGFloat yDistance = from.y - to.y;
-
- CGFloat distance = sqrt(xDistance * xDistance + yDistance * yDistance);
-
- // Early exit, since one of touches has moved enough to fire a drag event.
- if (distance > kGLGestureMovementDistance) {
- [delayTimer fire];
- [self.pandemoniumView pandemoniumTouchesMoved:cleared withEvent:event];
- return;
- }
- }
- return;
- }
-
- [self.pandemoniumView pandemoniumTouchesMoved:cleared withEvent:event];
-
- [super touchesMoved:touches withEvent:event];
-}
-
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- [delayTimer fire];
-
- NSSet *cleared = [self copyClearedTouches:touches phase:UITouchPhaseEnded];
- [self.pandemoniumView pandemoniumTouchesEnded:cleared withEvent:event];
-
- [super touchesEnded:touches withEvent:event];
-}
-
-- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
- [delayTimer fire];
- [self.pandemoniumView pandemoniumTouchesCancelled:touches withEvent:event];
-
- [super touchesCancelled:touches withEvent:event];
-}
-
-- (NSSet *)copyClearedTouches:(NSSet *)touches phase:(UITouchPhase)phaseToSave {
- NSMutableSet *cleared = [touches mutableCopy];
-
- for (UITouch *touch in touches) {
- if (touch.view != self.view || touch.phase != phaseToSave) {
- [cleared removeObject:touch];
- }
- }
-
- return cleared;
-}
-
-@end