Class: Dommy::MouseEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/dommy/event.rb

Direct Known Subclasses

DragEvent, PointerEvent, WheelEvent

Constant Summary

Constants inherited from Event

Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE

Instance Attribute Summary

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from Event

#__internal_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_set_current_target__, #__internal_set_dispatch_flag__, #__internal_set_event_phase__, #__js_call__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Methods included from Bridge::Methods

included

Constructor Details

#initialize(type, init = nil) ⇒ MouseEvent

Returns a new instance of MouseEvent.



535
536
537
538
539
540
541
542
543
544
# File 'lib/dommy/event.rb', line 535

def initialize(type, init = nil)
  super
  @button = read_init(init, "button") || 0
  @ctrl_key = !!read_init(init, "ctrlKey")
  @shift_key = !!read_init(init, "shiftKey")
  @alt_key = !!read_init(init, "altKey")
  @meta_key = !!read_init(init, "metaKey")
  @client_x = read_init(init, "clientX") || 0
  @client_y = read_init(init, "clientY") || 0
end

Instance Method Details

#__js_get__(key) ⇒ Object



546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/dommy/event.rb', line 546

def __js_get__(key)
  case key
  when "button"
    @button
  when "ctrlKey"
    @ctrl_key
  when "shiftKey"
    @shift_key
  when "altKey"
    @alt_key
  when "metaKey"
    @meta_key
  when "clientX"
    @client_x
  when "clientY"
    @client_y
  else
    super
  end
end