Module: Watir::DragAndDropHelper

Included in:
Element
Defined in:
lib/watir-classic/drag_and_drop_helper.rb

Instance Method Summary collapse

Instance Method Details

#drag_and_drop_by(distance_x, distance_y) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/watir-classic/drag_and_drop_helper.rb', line 15

def drag_and_drop_by(distance_x, distance_y)
  perform_action do
    drag_to do |mouse|
      drag_x, drag_y = source_x_y
      ole_object.document.parentWindow.scrollTo(drag_x + distance_x, drag_y + distance_y)
      drag_x, drag_y = source_x_y
      mouse.move :x => drag_x + distance_x, :y => drag_y + distance_y
    end
  end
end

#drag_and_drop_on(target) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/watir-classic/drag_and_drop_helper.rb', line 4

def drag_and_drop_on(target)
  perform_action do
    assert_target target
    drag_to do |mouse|
      ole_object.document.parentWindow.scrollTo(*target.send(:source_x_y_relative))
      drop_x, drop_y = target.send(:source_x_y)
      mouse.move :x => drop_x, :y => drop_y
    end
  end
end