Completed
Push — master ( 3d0615...9036a3 )
by Yoh
01:06
created

AliasPosition.y()   A

Complexity

Conditions 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
1
module Hyalite
2
  module DOM
3
    module Event
4
      class AliasPosition
5
        def initialize(native, name)
6
          @native = native
7
          @name = name
8
        end
9
10
        def x
11
          name = @name + 'X'
12
          `#@native[name]`
13
        end
14
15
        def y
16
          name = @name + 'Y'
17
          `#@native[name]`
18
        end
19
      end
20
21
      module MouseEventInterface
22
        def client
23
          @client ||= AliasPosition.new(@native, :client)
24
        end
25
26
        def movement
27
          @movement ||= AliasPosition.new(@native, :movement)
28
        end
29
30
        def offset
31
          @offset ||= AliasPosition.new(@native, :offset)
32
        end
33
34
        def page
35
          @page ||= AliasPosition.new(@native, :page)
36
        end
37
38
        def screen
39
          @screen ||= AliasPosition.new(@native, :screen)
40
        end
41
42
        def shift_key
43
          `#@native.shiftKey`
44
        end
45
46
        def ctrl_key
47
          `#@native.ctrlKey`
48
        end
49
50
        def alt_key
51
          `#@native.altKey`
52
        end
53
54
        def meta_key
55
          `#@native.metaKey`
56
        end
57
58
        def button
59
          `#@native.button`
60
        end
61
62
        def buttons
63
          `#@native.buttons`
64
        end
65
66
        def region
67
          `#@native.region`
68
        end
69
70
        def related_target
71
          `#@native.relatedTarget`
72
        end
73
74
        def modifire_state
75
          `#@native.getModifierState()`
76
        end
77
78
        def init_mouse_event
79
          `#@native.initMouseEvent()`
80
        end
81
      end
82
    end
83
  end
84
end
85