Sha256: 6985065805e9bf3ea04129f438312c6634ad9281b9115cbb4c12d965778a3864

Contents?: true

Size: 603 Bytes

Versions: 4

Compression:

Stored size: 603 Bytes

Contents

module MotionPrime
  class ButtonElement < BaseElement
    include MotionPrime::ElementContentPaddingMixin
    include MotionPrime::ElementContentTextMixin

    after_render :size_to_fit

    def size_to_fit
      if computed_options[:size_to_fit]
        if computed_options[:width]
          view.setHeight cached_content_outer_height
        end
      end
    end

    def view_class
      "MPButton"
    end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-prime-1.0.7 motion-prime/elements/button.rb
motion-prime-1.0.6 motion-prime/elements/button.rb
motion-prime-1.0.5 motion-prime/elements/button.rb
motion-prime-1.0.4 motion-prime/elements/button.rb