| 1 |
@function _radial-arg-parser($G1, $G2, $pos, $shape-size) { |
| 2 |
@each $value in $G1, $G2 { |
| 3 |
$first-val: nth($value, 1); |
| 4 |
$pos-type: type-of($first-val); |
| 5 |
$spec-at-index: null; |
| 6 |
|
| 7 |
// Determine if spec was passed to mixin |
| 8 |
@if type-of($value) == list { |
| 9 |
$spec-at-index: if(index($value, at), index($value, at), false); |
| 10 |
} |
| 11 |
@if $spec-at-index { |
| 12 |
@if $spec-at-index > 1 { |
| 13 |
@for $i from 1 through ($spec-at-index - 1) { |
| 14 |
$shape-size: $shape-size nth($value, $i); |
| 15 |
} |
| 16 |
@for $i from ($spec-at-index + 1) through length($value) { |
| 17 |
$pos: $pos nth($value, $i); |
| 18 |
} |
| 19 |
} |
| 20 |
@else if $spec-at-index == 1 { |
| 21 |
@for $i from ($spec-at-index + 1) through length($value) { |
| 22 |
$pos: $pos nth($value, $i); |
| 23 |
} |
| 24 |
} |
| 25 |
$G1: false; |
| 26 |
} |
| 27 |
|
| 28 |
// If not spec calculate correct values |
| 29 |
@else { |
| 30 |
@if ($pos-type != color) or ($first-val != "transparent") { |
| 31 |
@if ($pos-type == number) |
| 32 |
or ($first-val == "center") |
| 33 |
or ($first-val == "top") |
| 34 |
or ($first-val == "right") |
| 35 |
or ($first-val == "bottom") |
| 36 |
or ($first-val == "left") { |
| 37 |
|
| 38 |
$pos: $value; |
| 39 |
|
| 40 |
@if $pos == $G1 { |
| 41 |
$G1: false; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
@else if |
| 46 |
($first-val == "ellipse") |
| 47 |
or ($first-val == "circle") |
| 48 |
or ($first-val == "closest-side") |
| 49 |
or ($first-val == "closest-corner") |
| 50 |
or ($first-val == "farthest-side") |
| 51 |
or ($first-val == "farthest-corner") |
| 52 |
or ($first-val == "contain") |
| 53 |
or ($first-val == "cover") { |
| 54 |
|
| 55 |
$shape-size: $value; |
| 56 |
|
| 57 |
@if $value == $G1 { |
| 58 |
$G1: false; |
| 59 |
} |
| 60 |
|
| 61 |
@else if $value == $G2 { |
| 62 |
$G2: false; |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
@return $G1, $G2, $pos, $shape-size; |
| 69 |
} |