Sha256: baadca83ceaf1517cc5af76866217dd4bca58691996d2e99b6c669c334eeeb64

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

module MotionPrime
  module ElementContentPaddingMixin
    def content_padding_left
      view.try(:padding_left) ||
        computed_options[:padding_left] ||
        computed_options[:padding] ||
        view_class.constantize.default_padding_left || 0
    end

    def content_padding_right
      view.try(:padding_right) ||
        computed_options[:padding_right] ||
        computed_options[:padding] ||
        view_class.constantize.default_padding_right || 0
    end

    def content_padding_top
      view.try(:padding_top) ||
        computed_options[:padding_top] ||
        computed_options[:padding] ||
        view_class.constantize.default_padding_top || 0
    end

    def content_padding_bottom
      view.try(:padding_bottom) ||
        computed_options[:padding_bottom] ||
        computed_options[:padding] ||
        view_class.constantize.default_padding_bottom || 0
    end

    def content_padding_height
      content_padding_top + content_padding_bottom
    end

    def content_padding_width
      content_padding_left + content_padding_right
    end

    def content_outer_height
      height = content_padding_height + content_height
      [[height, computed_options[:min_outer_height]].compact.max, computed_options[:max_outer_height]].compact.min
    end

    def content_outer_width
      width = content_padding_width + content_width
      [[width, computed_options[:min_outer_width]].compact.max, computed_options[:max_outer_width]].compact.min
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-prime-0.3.2 motion-prime/elements/_content_padding_mixin.rb