Skip to content

Commit cf79aaa

Browse files
committed
fix: support native multi-touch in iOS stream
1 parent 4675927 commit cf79aaa

4 files changed

Lines changed: 297 additions & 72 deletions

File tree

ios/SimDeckStudio.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
364364
CODE_SIGN_ENTITLEMENTS = SimDeckStudio/SimDeckStudio.entitlements;
365365
CODE_SIGN_STYLE = Automatic;
366-
CURRENT_PROJECT_VERSION = 20260519025732;
366+
CURRENT_PROJECT_VERSION = 20260519032641;
367367
DEVELOPMENT_ASSET_PATHS = "";
368368
DEVELOPMENT_TEAM = CS838V553Y;
369369
ENABLE_PREVIEWS = YES;
@@ -392,7 +392,7 @@
392392
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
393393
CODE_SIGN_ENTITLEMENTS = SimDeckStudio/SimDeckStudio.entitlements;
394394
CODE_SIGN_STYLE = Automatic;
395-
CURRENT_PROJECT_VERSION = 20260519025732;
395+
CURRENT_PROJECT_VERSION = 20260519032641;
396396
DEVELOPMENT_ASSET_PATHS = "";
397397
DEVELOPMENT_TEAM = CS838V553Y;
398398
ENABLE_PREVIEWS = YES;

ios/SimDeckStudio/App/AppModel.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,10 @@ final class AppModel {
756756
streamClient?.sendEdgeTouch(x: Double(point.x), y: Double(point.y), phase: phase, edge: edge)
757757
}
758758

759+
func sendEdgeTouch(x: Double, y: Double, phase: String, edge: String) {
760+
streamClient?.sendEdgeTouch(x: x, y: y, phase: phase, edge: edge)
761+
}
762+
759763
func normalizedTouchPoint(location: CGPoint, in screenFrame: CGRect) -> CGPoint? {
760764
guard screenFrame.width > 0, screenFrame.height > 0 else { return nil }
761765
let x = ((location.x - screenFrame.minX) / screenFrame.width).clamped(to: 0...1)
@@ -786,6 +790,10 @@ final class AppModel {
786790
streamClient?.sendTouch(x: x, y: y, phase: phase)
787791
}
788792

793+
func sendMultiTouch(x1: Double, y1: Double, x2: Double, y2: Double, phase: String) {
794+
streamClient?.sendMultiTouch(x1: x1, y1: y1, x2: x2, y2: y2, phase: phase)
795+
}
796+
789797
func sendKeyboardText(_ text: String) {
790798
for character in text {
791799
guard let key = Self.keyControl(for: character) else {

ios/SimDeckStudio/Streaming/WebRTCClient.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ final class WebRTCClient: NSObject {
195195
sendJSON(["type": "edgeTouch", "x": x, "y": y, "phase": phase, "edge": edge])
196196
}
197197

198+
func sendMultiTouch(x1: Double, y1: Double, x2: Double, y2: Double, phase: String) {
199+
markUserActivity()
200+
sendJSON([
201+
"type": "multiTouch",
202+
"x1": x1,
203+
"y1": y1,
204+
"x2": x2,
205+
"y2": y2,
206+
"phase": phase
207+
])
208+
}
209+
198210
@discardableResult
199211
func sendKey(keyCode: Int, modifiers: Int) -> Bool {
200212
markUserActivity()

0 commit comments

Comments
 (0)