Godot Engine – Multi-platform 2D and 3D game engine
[iOS] Set `double_tap` in the touch release events.
Pāvels Nadtočajevs45efecc476e2
diff --git a/drivers/apple_embedded/godot_view_apple_embedded.mm b/drivers/apple_embedded/godot_view_apple_embedded.mmindex f051ffcaf37..b5336051efb 100644--- a/drivers/apple_embedded/godot_view_apple_embedded.mm+++ b/drivers/apple_embedded/godot_view_apple_embedded.mm@@ -47,6 +47,7 @@ static const float earth_gravity = 9.80665;CGFloat last_edr_headroom;NSTimeInterval begin_timestamp[max_touches];CGPoint begin_delta[max_touches];+ int touch_count[max_touches];}@property(assign, nonatomic) BOOL isActive;@@ -133,7 +134,7 @@ static const float earth_gravity = 9.80665;[self registerForTraitChanges:@[ [UITraitUserInterfaceStyle class] ] withTarget:self action:@selector(traitCollectionDidChangeWithView:previousTraitCollection:)];}- [self initTouches];+ [self clearTouches];self.multipleTouchEnabled = YES;@@ -308,12 +309,6 @@ static const float earth_gravity = 9.80665;// MARK: Touches-- (void)initTouches {- for (int i = 0; i < max_touches; i++) {- godot_touches[i] = nullptr;- }-}-- (int)getTouchIDForTouch:(UITouch *)p_touch {int first = -1;for (int i = 0; i < max_touches; i++) {@@ -342,6 +337,9 @@ static const float earth_gravity = 9.80665;}if (godot_touches[i] == p_touch) {godot_touches[i] = nullptr;+ begin_timestamp[i] = 0.0;+ begin_delta[i] = CGPointMake(0, 0);+ touch_count[i] = 0;} else {++remaining;}@@ -352,6 +350,9 @@ static const float earth_gravity = 9.80665;- (void)clearTouches {for (int i = 0; i < max_touches; i++) {godot_touches[i] = nullptr;+ begin_timestamp[i] = 0.0;+ begin_delta[i] = CGPointMake(0, 0);+ touch_count[i] = 0;}}@@ -362,6 +363,7 @@ static const float earth_gravity = 9.80665;CGPoint touchPoint = [touch locationInView:self];begin_timestamp[tid] = [touch timestamp];begin_delta[tid] = CGPointMake(0, 0);+ touch_count[tid] = touch.tapCount;DisplayServerAppleEmbedded::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1, false);}}@@ -393,9 +395,9 @@ static const float earth_gravity = 9.80665;for (UITouch *touch in touches) {int tid = [self getTouchIDForTouch:touch];ERR_FAIL_COND(tid == -1);- [self removeTouch:touch];CGPoint touchPoint = [touch locationInView:self];- DisplayServerAppleEmbedded::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false, false);+ DisplayServerAppleEmbedded::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, touch_count[tid] > 1, false);+ [self removeTouch:touch];}}