Run a virtual iPhone on an Apple Silicon Mac.
Swift
Account for window scale when mapping touches
Luke943c6bd8bbd4
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachineView.swift b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachineView.swiftindex 9950b239..ef120a67 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachineView.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachineView.swift@@ -1208,10 +1208,17 @@ var panel = normalizeCoordinate(localPoint)/// outer or inner viewport. Input must be measured against that clipped/// rectangle; using the full backing bounds makes outer-screen touches/// land in the hidden part of the framebuffer.+ /// Use the panel's fraction of the backing framebuffer in view coordinates+ /// to account for window scaling.private var touchViewportSize: CGSize {- if let active = activePanelPixels, active.width > 0, active.height > 0,- screenScale > 0 {- return CGSize(width: active.width / screenScale, height: active.height / screenScale)+ if let active = activePanelPixels,+ let backing = recordingGraphicsDisplay?.sizeInPixels,+ active.width > 0, active.height > 0,+ backing.width > 0, backing.height > 0 {+ return CGSize(+ width: bounds.width * active.width / backing.width,+ height: bounds.height * active.height / backing.height,+ )}return bounds.size}