Method: Fidgit::Selection#update_drag
- Defined in:
- lib/fidgit/selection.rb
#update_drag(x, y) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/fidgit/selection.rb', line 83 def update_drag(x, y) x, y = x.round, y.round # If the mouse has been dragged far enough from the initial click position, then 'pick up' the objects and drag. unless moved? if distance(@initial_x, @initial_y, x, y) > MIN_DRAG_DISTANCE @items.each { |o| o.dragging = true } @moved = true end end if moved? @items.each do |o| o.x += x - @last_x o.y += y - @last_y end @last_x, @last_y = x, y end self end |