Method: MotionPrime::DrawElement#draw_options

Defined in:
motion-prime/elements/draw.rb

#draw_optionsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'motion-prime/elements/draw.rb', line 10

def draw_options
  options = computed_options
  background_color = options[:background_color].try(:uicolor)
  layer_options = options[:layer] || {}
  corner_radius = layer_options[:corner_radius].to_f

  layer_options.delete(:masks_to_bounds) if layer_options[:masks_to_bounds].nil?
  options.delete(:clips_to_bounds) if options[:clips_to_bounds].nil?
  masks_to_bounds = layer_options.fetch(:masks_to_bounds, options.fetch(:clips_to_bounds, corner_radius > 0))
  {
    rect: CGRectMake(frame_left, frame_top, frame_outer_width, frame_outer_height),
    background_color: background_color,
    masks_to_bounds: masks_to_bounds,
    corner_radius: corner_radius,
    rounded_corners: layer_options[:rounded_corners],
    border_width: layer_options[:border_width].to_f,
    border_color: layer_options[:border_color].try(:uicolor) || background_color,
    border_sides: layer_options[:border_sides],
    dashes: layer_options[:dashes]
  }
end