title: SwiftUI Can't PanGesture an Image
body: <p>I have not been able to find an equivalent to the pan gesture in SwiftUI. I do see
   and use magnify, tap, drag and rotate - but I do not see any built in pan. In the
   following code snippet I add an image and allow the user to zoom - but I want the 
   user to also move the zoomed image to focus on the area of interest. Dragging, of
   course does not do the job - it just moves the frame.</p>
  
  <p>I tried layering a frame on top and moving the bottom image but could not make that
   work either.</p>
  
  <pre><code> struct ContentView: View {
  
      @State var scale: CGFloat = 1.0
      @State var isScaled: Bool = false
      @State private var dragOffset = CGSize.zero
  
      var body: some View {
          GeometryReader { geo in
              VStack {
                  ZStack{
                      RoundedRectangle(cornerRadius: 40)
                          .foregroundColor(Color.white)
                          .frame(width: geo.size.width - 45, height: geo.size.width - 45)
                          .shadow(radius: 10)
  
                      Image("HuckALaHuckMedium")
                          .resizable()
                          .scaleEffect(self.scale)
                          .frame(width: geo.size.width - 60, height: geo.size.width - 60)
                          .cornerRadius(40)
                          .aspectRatio(contentMode: .fill)
                          .shadow(radius: 10, x: 20, y: 20)
  
                          //need pan not drag
                          .gesture(
                              DragGesture()
                                  .onChanged { self.dragOffset = $0.translation }
                                  .onEnded { _ in self.dragOffset = .zero }
                          )
                          //this works but you can't "zoom twice"
                          .gesture(MagnificationGesture()
                              .onChanged { value in
                                  self.scale = self.isScaled ? 1.0 : value.magnitude
                          }
                          .onEnded({ value in
                              //self.scale = 1.0
                              self.isScaled.toggle()
                          })
                          )
                          .animation(.easeInOut)
                          .offset(self.dragOffset)
                  }//zstack
                  Spacer()
              }
          }
      }
  }
  </code></pre>
  
  <p>An original image example:</p>
  
  <p><a href="https://i.stack.imgur.com/NWOv9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NWOv9.png" alt="enter image description here"></a></p>
  
  <p>And that image after zoom - but with drag not pan:</p>
  
  <p><a href="https://i.stack.imgur.com/oBuvV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oBuvV.png" alt="enter image description here"></a></p>
  
  <p>Any guidance would be appreciated. Xcode 11.3 (11C29)</p>