[feat] allow pinch zoom outside the remote image on mobile

This commit is contained in:
dijunkun
2026-10-18 22:09:35 +08:00
parent acd56dfc29
commit 36f7213162
4 changed files with 12 additions and 5 deletions
@@ -375,7 +375,8 @@ final class RemoteTouchSurface: UIView, UIGestureRecognizerDelegate {
let focus = recognizer.location(in: self)
switch recognizer.state {
case .began:
pinchActive = renderRect()?.contains(focus) == true
// The full touch surface accepts pinches, including letterboxing.
pinchActive = bounds.contains(focus) && renderRect() != nil
recognizer.scale = 1
case .changed:
guard pinchActive else { return }
@@ -414,13 +415,13 @@ final class RemoteTouchSurface: UIView, UIGestureRecognizerDelegate {
if viewportScale > 1.001 || pinchActive {
switch recognizer.state {
case .began:
viewportPanActive = renderRect()?.contains(
viewportPanActive = pinchActive || renderRect()?.contains(
recognizer.location(in: self)
) == true
recognizer.setTranslation(.zero, in: self)
case .changed:
if !viewportPanActive {
viewportPanActive = renderRect()?.contains(
viewportPanActive = pinchActive || renderRect()?.contains(
recognizer.location(in: self)
) == true
}
+5
View File
@@ -431,6 +431,11 @@ Old previews saved without this choice are removed on upgrade.
## Pointer edge panning
Pinch-to-zoom can start anywhere on the touch surface, including black margins
outside the image, in either pointer mode. A pinch also follows the fingers'
midpoint movement when it starts in a margin. Held virtual mouse buttons still
prevent viewport gestures.
In relative mouse mode, continuing to move outward at the top or bottom of the
visible image pans the video vertically in the opposite direction. Moving
down-left at the bottom edge pans upward without shifting the video horizontally;