Class: RubyRich::Viewport

Inherits:
Object
  • Object
show all
Defined in:
lib/clacky/rich_ui_controller.rb

Instance Method Summary collapse

Instance Method Details

#clacky_handle_event_without_text_selectionObject



19
# File 'lib/clacky/rich_ui_controller.rb', line 19

alias_method :clacky_handle_event_without_text_selection, :handle_event

#handle_event(event_data, layout = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/clacky/rich_ui_controller.rb', line 21

def handle_event(event_data, layout = nil)
  return false if keyboard_event?(event_data) && !@focused

  case event_data[:name]
  when :mouse_down
    return copy_selection if event_data[:button] == :right

    start_scrollbar_drag(event_data, layout) || start_selection(event_data, layout)
  when :mouse_drag
    drag_scrollbar(event_data, layout) || drag_selection(event_data, layout)
  when :mouse_up
    stop_scrollbar_drag || clacky_stop_selection_without_copy
  else
    clacky_handle_event_without_text_selection(event_data, layout)
  end
end