motion/ui/ui_control_wrapper.rb in bubble-wrap-1.7.1 vs motion/ui/ui_control_wrapper.rb in bubble-wrap-1.8.0
- old
+ new
@@ -1,8 +1,10 @@
module BubbleWrap
module UIControlWrapper
def when(events, options = {}, &block)
+ events = BW::Constants.get("UIControlEvent", events)
+
@callback ||= {}
@callback[events] ||= []
unless options[:append]
@callback[events] = []
@@ -12,6 +14,31 @@
@callback[events] << block
block.weak! if BubbleWrap.use_weak_callbacks?
addTarget(@callback[events].last, action:'call', forControlEvents: events)
end
end
+
+ Constants.register(
+ UIControlEventTouchDown,
+ UIControlEventTouchDownRepeat,
+ UIControlEventTouchDragInside,
+ UIControlEventTouchDragOutside,
+ UIControlEventTouchDragEnter,
+ UIControlEventTouchDragExit,
+ UIControlEventTouchUpInside,
+ UIControlEventTouchUpOutside,
+ UIControlEventTouchCancel,
+
+ UIControlEventValueChanged,
+
+ UIControlEventEditingDidBegin,
+ UIControlEventEditingChanged,
+ UIControlEventEditingDidEnd,
+ UIControlEventEditingDidEndOnExit,
+
+ UIControlEventAllTouchEvents,
+ UIControlEventAllEditingEvents,
+ # UIControlEventApplicationReserved,
+ # UIControlEventSystemReserved,
+ UIControlEventAllEvents
+ )
end