motion-prime/views/view_styler.rb in motion-prime-0.4.3 vs motion-prime/views/view_styler.rb in motion-prime-0.4.4

- old
+ new

@@ -26,30 +26,29 @@ result end end def prepare_frame_for(bounds) - options[:frame] = calculate_frome_for(bounds, options) - + options[:frame] = calculate_frome_for(bounds, options.merge(test: view.is_a?(UITextView))) if options.slice(:width, :height, :right, :bottom, :height_to_fit).values.any? mask = UIViewAutoresizingNone mask |= UIViewAutoresizingFlexibleTopMargin if options[:top].nil? mask |= UIViewAutoresizingFlexibleLeftMargin if options[:left].nil? mask |= UIViewAutoresizingFlexibleBottomMargin if options[:bottom].nil? mask |= UIViewAutoresizingFlexibleRightMargin if options[:right].nil? mask |= UIViewAutoresizingFlexibleWidth if !options[:left].nil? && !options[:right].nil? - mask |= UIViewAutoresizingFlexibleHeight if !options[:top].nil? && !options[:bottom].nil? + mask |= UIViewAutoresizingFlexibleHeight if options[:height_to_fit].nil? && (!options[:top].nil? && !options[:bottom].nil?) options[:autoresizingMask] = mask end end def set_option(key, value) # return if value.nil? # ignore options return if key == 'section' && !view.respond_to?(:section=) return if key == 'size_to_fit' && view.is_a?(UILabel) - return if (key == 'url' || key == 'default') && view.is_a?(UIImageView) + return if %w[url default draw_in_rect].include?(key.to_s) && view.is_a?(UIImageView) return if %w[ styles has_drawn_content width height top right bottom left value_type max_width max_outer_width min_width min_outer_width max_height max_outer_height min_height min_outer_width @@ -103,17 +102,9 @@ mask_path = UIBezierPath.bezierPathWithRoundedRect(bounds, byRoundingCorners: corners, cornerRadii: CGSizeMake(radius, radius)) mask_layer = CAShapeLayer.layer mask_layer.frame = bounds mask_layer.path = mask_path.CGPath view.mask = mask_layer - elsif key == 'mask' - radius = value[:radius] - bounds = CGRectMake(0, 0, value[:width], value[:height]) - mask_path = UIBezierPath.bezierPathWithRoundedRect(bounds, byRoundingCorners: UIRectCornerAllCorners, cornerRadii: CGSizeMake(radius, radius)) - mask_layer = CAShapeLayer.layer - mask_layer.frame = bounds - mask_layer.path = mask_path.CGPath - view.layer.mask = mask_layer elsif key == 'attributed_text_options' attributes = {} if line_spacing = value[:line_spacing] paragrahStyle = NSMutableParagraphStyle.alloc.init paragrahStyle.setLineSpacing(line_spacing) \ No newline at end of file