lib/under_os/ui/slider.rb in under-os-1.1.0 vs lib/under_os/ui/slider.rb in under-os-1.2.0
- old
+ new
@@ -1,19 +1,16 @@
-class UnderOs::UI::Slider < UnderOs::UI::View
- include UnderOs::UI::Editable
-
+class UnderOs::UI::Slider < UnderOs::UI::Input
wraps UISlider, tag: 'slider'
def initialize(options={})
super
self.min = options[:min] if options[:min]
self.max = options[:max] if options[:max]
- self.value = options[:value] if options[:value]
@_.continuous = options.delete(:track) || true # track the changes as they go
- @_.addTarget self, action: :fire_change_event, forControlEvents:UIControlEventValueChanged
+ @_.addTarget self, action: :handle_change, forControlEvents:UIControlEventValueChanged
end
def value
@_.value
end
@@ -34,16 +31,7 @@
@_.maximumValue
end
def max=(value)
@_.maximumValue = value.to_f
- end
-
-private
-
- def fire_change_event
- if @_prev_value != @_.value
- @_prev_value = @_.value
- emit :change
- end
end
end