Class: UnderOs::UI::Events::Event

Inherits:
Events::Event
  • Object
show all
Defined in:
lib/under_os/ui/utils/events.rb

Constant Summary collapse

RECOGNIZER_STATES =
{
  UIGestureRecognizerStateBegan     => :began,
  UIGestureRecognizerStateChanged   => :changed,
  UIGestureRecognizerStateEnded     => :ended,
  UIGestureRecognizerStateCancelled => :canceled,
  UIGestureRecognizerStateFailed    => :failed
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original, target, event, params = {}) ⇒ Event

Returns a new instance of Event.



164
165
166
167
168
169
# File 'lib/under_os/ui/utils/events.rb', line 164

def initialize(original, target, event, params={})
  @_      = original
  @target = target

  super event, params
end

Instance Attribute Details

#_Object (readonly)

Returns the value of attribute _.



162
163
164
# File 'lib/under_os/ui/utils/events.rb', line 162

def _
  @_
end

#targetObject (readonly)

Returns the value of attribute target.



162
163
164
# File 'lib/under_os/ui/utils/events.rb', line 162

def target
  @target
end

Instance Method Details

#angleObject



179
180
181
# File 'lib/under_os/ui/utils/events.rb', line 179

def angle
  @_.rotation
end

#angle=(value) ⇒ Object



183
184
185
# File 'lib/under_os/ui/utils/events.rb', line 183

def angle=(value)
  @_.rotation = value
end

#scaleObject



171
172
173
# File 'lib/under_os/ui/utils/events.rb', line 171

def scale
  @_.scale
end

#scale=(value) ⇒ Object



175
176
177
# File 'lib/under_os/ui/utils/events.rb', line 175

def scale=(value)
  @_.scale = value
end

#stateObject



206
207
208
# File 'lib/under_os/ui/utils/events.rb', line 206

def state
  RECOGNIZER_STATES[@_.state]
end

#translation(view) ⇒ Object



187
188
189
190
# File 'lib/under_os/ui/utils/events.rb', line 187

def translation(view)
  view = view._ if view.is_a?(UnderOs::UI::View)
  @_.translationInView(view)
end

#translation=(params) ⇒ Object



192
193
194
195
196
# File 'lib/under_os/ui/utils/events.rb', line 192

def translation=(params)
  point = params[0]; view = params[1]
  view = view._ if view.is_a?(UnderOs::UI::View)
  @_.setTranslation(point, inView:view)
end