Sha256: 831ac02b2f09d9b2f72c85d3e75d605f85c88ff45be7c9d6d2e9ff5014e42fe6
Contents?: true
Size: 1.24 KB
Versions: 53
Compression:
Stored size: 1.24 KB
Contents
module MotionPrime module SupportPaddingAttribute extend ::MotionSupport::Concern included do attr_accessor :paddingLeft, :paddingRight, :paddingTop, :paddingBottom, :padding end module ClassMethods def default_padding_top 0 end def default_padding_left 0 end def default_padding_right 0 end def default_padding_bottom 0 end end def padding_left self.paddingLeft || self.padding || self.class.default_padding_left end def padding_right self.paddingRight || self.padding || self.class.default_padding_right end def padding_top self.paddingTop || self.padding || self.class.default_padding_top end def padding_bottom self.paddingBottom || self.padding || self.class.default_padding_bottom end def padding_insets UIEdgeInsetsMake(padding_top, padding_left, padding_bottom, padding_right) end def apply_padding(rect) return unless apply_padding? apply_padding!(rect) end def apply_padding!(rect) raise "requires implementation" end def apply_padding? ![padding_top, padding_left, padding_right, padding_bottom].all?(&:zero?) end end end
Version data entries
53 entries across 53 versions & 1 rubygems