Method: Motion::Xray::XrayDpad#touchesMoved

Defined in:
lib/motion-xray/views/xray_dpad.rb

#touchesMoved(touches, withEvent: event) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/motion-xray/views/xray_dpad.rb', line 105

def touchesMoved(touches, withEvent:event)
  super
  return unless @pressing

  point = touches.anyObject.locationInView(self)
  if @pressing == :center
    dx = point.x - @started_location.x
    dy = point.y - @started_location.y
    fire(CGPoint.new(dx, dy))
    @started_location = point
  else
    if get_pressing(point) != @pressing
      @was_pressing = false
      set_pressing_image(nil)
    else
      @was_pressing = true
      set_pressing_image(@pressing)
    end
  end
end