|
|
|
|
@ -53,6 +53,10 @@ module Squib
|
|
|
|
|
add_parent_child(parent_val, child_val) |
|
|
|
|
elsif child_val.to_s.strip.start_with?('-=') |
|
|
|
|
sub_parent_child(parent_val, child_val) |
|
|
|
|
elsif child_val.to_s.strip.start_with?('x=') |
|
|
|
|
mul_parent_child(parent_val, child_val) |
|
|
|
|
elsif child_val.to_s.strip.start_with?('/=') |
|
|
|
|
div_parent_child(parent_val, child_val) |
|
|
|
|
else |
|
|
|
|
child_val # child overrides parent when merging, no += |
|
|
|
|
end |
|
|
|
|
@ -76,6 +80,18 @@ module Squib
|
|
|
|
|
parent_pixels - child_pixels |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def mul_parent_child(parent, child) |
|
|
|
|
parent_pixels = Args::UnitConversion.parse(parent, @dpi).to_f |
|
|
|
|
child_float = child.sub('x=', '').to_f |
|
|
|
|
parent_pixels * child_float |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def div_parent_child(parent, child) |
|
|
|
|
parent_pixels = Args::UnitConversion.parse(parent, @dpi).to_f |
|
|
|
|
child_float = child.sub('/=', '').to_f |
|
|
|
|
parent_pixels / child_float |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# Does this layout entry have an extends field? |
|
|
|
|
# i.e. is it a base-case or will it need recursion? |
|
|
|
|
# :nodoc: |
|
|
|
|
|