Class: Dommy::MouseEvent

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

Direct Known Subclasses

DragEvent

Instance Attribute Summary

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from Event

#__js_call__, #__js_set__, #__prepare_for_dispatch__, #__record_path__, #__set_current_target__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Constructor Details

#initialize(type, init = nil) ⇒ MouseEvent

Returns a new instance of MouseEvent.



364
365
366
367
368
369
370
371
372
373
# File 'lib/dommy/event.rb', line 364

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



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/dommy/event.rb', line 375

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