Sha256: 049e917de653277fa9a11ec4796588956309e6f2e19e192483f84140a2e385ec

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

module MotionPrime
  class ButtonElement < BaseElement
    include MotionPrime::ElementFieldDimensionsMixin

    after_render :size_to_fit

    def size_to_fit
      if computed_options[:size_to_fit] || style_options[:size_to_fit]
        if computed_options[:width]
          view.setHeight computed_height
        end
      end
    end

    def view_class
      "DMButton"
    end

    def text_value
      view.try(:currentTitle) || computed_options[:title]
    end

    def font
      computed_options[:title_label].try(:[], :font) || :system.uifont
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
motion-prime-0.3.1 motion-prime/elements/button.rb
motion-prime-0.3.0 motion-prime/elements/button.rb