Class: Browser::Event::Drag

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

Overview

TODO: handle transfers

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, #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


68
69
70
# File 'opal/browser/event/drag.rb', line 68

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

.supported?Boolean

Returns:

  • (Boolean)

5
6
7
# File 'opal/browser/event/drag.rb', line 5

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

Instance Method Details

#clientObject


93
94
95
# File 'opal/browser/event/drag.rb', line 93

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

109
110
111
# File 'opal/browser/event/drag.rb', line 109

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

#screenObject


97
98
99
# File 'opal/browser/event/drag.rb', line 97

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

#transferObject

Raises:

  • (NotImplementedError)

See Also:


114
115
116
# File 'opal/browser/event/drag.rb', line 114

def transfer
  raise NotImplementedError
end

#xObject


101
102
103
# File 'opal/browser/event/drag.rb', line 101

def x
  screen.x
end

#yObject


105
106
107
# File 'opal/browser/event/drag.rb', line 105

def y
  screen.y
end