Sha256: 0d14fa15dcfa3c6e8232d3e3d045bee3fbf71b2e7dd9cba03c1528fe490bedb3

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 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] || style_options[:size_to_fit]
        if computed_options[:width]
          view.setHeight cached_content_outer_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.4.1 motion-prime/elements/button.rb
motion-prime-0.4.0 motion-prime/elements/button.rb