class Fidgit::ScrollBar::Handle
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
Fidgit::Element::new
# File lib/fidgit/elements/scroll_bar.rb, line 13 def initialize(options = {}) super options subscribe :begin_drag do |sender, x, y| # Store position of the handle when it starts to drag. @drag_start_pos = [x - self.x, y - self.y] end subscribe :update_drag do |sender, x, y| parent.parent.handle_dragged_to x - @drag_start_pos[0], y - @drag_start_pos[1] end subscribe :end_drag do @drag_start_pos = nil end end
Public Instance Methods
drag?(button)
click to toggle source
# File lib/fidgit/elements/scroll_bar.rb, line 11 def drag?(button); button == :left; end