Sha256: 7e179392705c9eb5456a795cb361b9b1f77925619ef3ce524700d956f297e169

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 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
      "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

1 entries across 1 versions & 1 rubygems

Version Path
motion-prime-0.4.2 motion-prime/elements/button.rb