Method: Fidgit::Slider#left_mouse_button

Defined in:
lib/fidgit/elements/slider.rb

#left_mouse_button(sender, x, y) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/fidgit/elements/slider.rb', line 92

def left_mouse_button(sender, x, y)
  # In this case, x should be the centre of the handle after it has moved.

  self.value = ((x - (@handle.width / 2) - self.x) / (width - @handle.width)) * (@range.max - @range.min) + @range.min
  @mouse_down = true

  nil
end