aboutsummaryrefslogtreecommitdiff
path: root/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-grid-math.scss
blob: 044801abe218a39149f07b855f241ad268172c2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SVG Grid Math
// =============



// SVG Column Position
// -------------------
/// Determine the proper horizontal position
/// for a column rectangle
///
/// @access private
///
/// @param {Integer} $column -
///   1-indexed column location on the grid
/// @param {Map} $grid -
///   Normalized settings map representing the current grid
///
/// @return {Length} -
///   Horizontal position of svg column rectangle,
///   as distance from the grid edge
@function _susy-svg-column-position(
  $column,
  $grid
) {
  $x: $column - 1;

  @if ($x > 0) {
    $x: susy-span(first $x wide, $grid);
  }

  @return $x;
}



// SVG Offset
// ----------
/// Determine if a grid image needs to be offset,
/// to account for edge gutters.
///
/// @access private
///
/// @param {Map} $grid -
///   Normalized settings map representing the current grid
///
/// @return {Length | null} -
///   Expected distance from container edge to first column,
///   based on spread values and gutter-widths
@function _susy-svg-offset(
  $grid
) {
  $columns: su-valid-columns(map-get($grid, 'columns'));
  $gutters: su-valid-gutters(map-get($grid, 'gutters'));
  $container: su-valid-spread(map-get($grid, 'container-spread')) + 1;

  @if ($container == 0) {
    @return null;
  }

  $gutter: su-call('su-gutter', $grid);

  @if (type-of($gutter) == 'string') {
    @return 'calc(#{$container} * #{$gutter} / 2)';
  }

  @return $container * $gutter / 2;
}