def pan(query, from, to, duration: nil)
      Query.ensure_valid_query(query)

      options = {
          duration: duration || DEFAULT_PAN_OPTIONS[:duration]
      }

      Calabash::Internal.with_current_target {|target| target.pan(Query.new(query), from, to, options)}
    end
def pan(query, from, to, duration: nil)
      Query.ensure_valid_query(query)

      options = {
          duration: duration || DEFAULT_PAN_OPTIONS[:duration]
      }

      Calabash::Internal.with_current_target {|target| target.pan(Query.new(query), from, to, options)}
    end
Performs a **pan** inside the first view that matches `query`.

 A pan is a straight line swipe that pauses at the final point
 before releasing the gesture. This is the general purpose pan method. For
 standardized pans see {pan_left}, {pan_right}, {pan_up}, and {pan_down}.

 @example
  # Consider a pan on a scrollable view.  When the finger is is released,
  # the velocity of the view is zero.

 @example
  # A scrollable view displays the alphabet. Panning left will cause the
  # view to scroll right.

  cal.pan("* id:'alphabetView'", cal.pct(80, 80), cal.pct(20, 80))

      Before             After
   ┌───────────┐  |  ┌───────────┐
   │ A B C D E │  |  │ E F G H I │
   │           │  |  │           │
   │ <───────┤ │  |  │           │
   └───────────┘  |  └───────────┘


 @param [String, Hash, Calabash::Query] query A query describing the view
  to pan inside.
 @param [Hash] from `({:x, :y})` The point at which the gesture
   originates from.
 @param [Hash] to `({:x, :y})` The point at which the gesture
   ends.
 @param [Number] duration (default: 1.0) The amount of time in seconds the
  gesture lasts.
 @raise [ViewNotFoundError] If the `query` returns no results.
 @raise [ArgumentError] If `query` is invalid.