Class: Browser::Event::Mouse
- Inherits:
-
UI
show all
- Defined in:
- lib/diamonds/opal/browser/event/mouse.rb
Defined Under Namespace
Classes: Definition
Instance Attribute Summary
#callback, #on
Class Method Summary
collapse
Instance Method Summary
collapse
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
143
144
145
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 143
def self.construct(name, desc)
`new MouseEvent(#{name}, #{desc})`
end
|
.supported? ⇒ Boolean
4
5
6
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 4
def self.supported?
not $$[:MouseEvent].nil?
end
|
Instance Method Details
189
190
191
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 189
def ancestor
Position.new(`#@native.x`, `#@native.y`) unless `#@native.x == null`
end
|
#click? ⇒ Boolean
213
214
215
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 213
def click?
name.downcase == 'click'
end
|
169
170
171
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 169
def client
Position.new(`#@native.clientX`, `#@native.clientY`)
end
|
#double_click? ⇒ Boolean
217
218
219
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 217
def double_click?
name.downcase == 'dblclick'
end
|
#down? ⇒ Boolean
221
222
223
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 221
def down?
name.downcase == 'mousedown'
end
|
#enter? ⇒ Boolean
225
226
227
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 225
def enter?
name.downcase == 'mouseenter'
end
|
205
206
207
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 205
def from
DOM(`#@native.fromElement`) unless `#@native.fromElement == null`
end
|
173
174
175
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 173
def layer
Position.new(`#@native.layerX`, `#@native.layerY`) unless `#@native.layerX == null`
end
|
#leave? ⇒ Boolean
229
230
231
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 229
def leave?
name.downcase == 'mouseleave'
end
|
#move? ⇒ Boolean
233
234
235
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 233
def move?
name.downcase == 'mousemove'
end
|
177
178
179
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 177
def offset
Position.new(`#@native.offsetX`, `#@native.offsetY`) unless `#@native.offsetX == null`
end
|
#out? ⇒ Boolean
237
238
239
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 237
def out?
name.downcase == 'mouseout'
end
|
#over? ⇒ Boolean
241
242
243
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 241
def over?
name.downcase == 'mouseover'
end
|
181
182
183
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 181
def page
Position.new(`#@native.pageX`, `#@native.pageY`) unless `#@native.pageX == null`
end
|
201
202
203
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 201
def related
DOM(`#@native.relatedTarget`) unless `#@native.relatedTarget == null`
end
|
185
186
187
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 185
def screen
Position.new(`#@native.screenX`, `#@native.screenY`) unless `#@native.screenX == null`
end
|
#show? ⇒ Boolean
249
250
251
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 249
def show?
name.downcase == 'show'
end
|
209
210
211
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 209
def to
DOM(`#@native.toElement`) unless `#@native.toElement == null`
end
|
#up? ⇒ Boolean
245
246
247
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 245
def up?
name.downcase == 'mouseup'
end
|
193
194
195
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 193
def x
screen.x
end
|
197
198
199
|
# File 'lib/diamonds/opal/browser/event/mouse.rb', line 197
def y
screen.y
end
|