mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-25 06:13:57 +08:00
[feat] allow pinch zoom outside the remote image on mobile
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user