Class: Browser::Event::Drag

Inherits:
Browser::Event show all
Defined in:
opal/browser/event/drag.rb

Defined Under Namespace

Classes: Definition

Instance Attribute Summary

Attributes inherited from Browser::Event

#callback, #on

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Browser::Event

aliases, #arguments, #arguments=, class_for, create, handlers, handles, #initialize, #name, name_for, new, #off, #prevent, #prevented?, #stop, #stop!, #stopped?, #target

Constructor Details

This class inherits a constructor from Browser::Event

Class Method Details

.construct(name, desc) ⇒ Object


70
71
72
# File 'opal/browser/event/drag.rb', line 70

def self.construct(name, desc)
  `new DragEvent(#{name}, #{desc})`
end

.supported?Boolean

Returns:

  • (Boolean)

7
8
9
# File 'opal/browser/event/drag.rb', line 7

def self.supported?
  Browser.supports? 'Event.Drag'
end

Instance Method Details

#clientObject


95
96
97
# File 'opal/browser/event/drag.rb', line 95

def client
  Position.new(`#@native.clientX`, `#@native.clientY`)
end

111
112
113
# File 'opal/browser/event/drag.rb', line 111

def related
  DOM(`#@native.relatedTarget`)
end

#screenObject


99
100
101
# File 'opal/browser/event/drag.rb', line 99

def screen
  Position.new(`#@native.screenX`, `#@native.screenY`) if defined?(`#@native.screenX`)
end

#transferObject

Returns a Browser::Event::DataTransfer related to this event


118
119
120
# File 'opal/browser/event/drag.rb', line 118

def transfer
  DataTransfer.new(`#@native.dataTransfer`)
end

#xObject


103
104
105
# File 'opal/browser/event/drag.rb', line 103

def x
  screen.x
end

#yObject


107
108
109
# File 'opal/browser/event/drag.rb', line 107

def y
  screen.y
end