diff --git a/sass_layout.scss b/sass_layout.scss index 51f0f38..6b1733a 100644 --- a/sass_layout.scss +++ b/sass_layout.scss @@ -74,6 +74,14 @@ $global-frame-map: () !global; } @mixin render-one-layout($node) { + @if map-get($node, bottom) != null { + $parent-height: if(has-parent($node), map-get(parent($node), height), 0); + $node: map-set($node, top, $parent-height - map-get($node, height) - map-get($node, bottom)); + } + @if map-get($node, right) != null { + $parent-width: if(has-parent($node), map-get(parent($node), width), 0); + $node: map-set($node, top, $parent-width - map-get($node, width) - map-get($node, right)); + } $node: calculate-params-on-direction($node, top); $node: calculate-params-on-direction($node, left); @if map-get($node, height) == 0 { diff --git a/test.scss b/test.scss index d84940c..37a3f61 100644 --- a/test.scss +++ b/test.scss @@ -417,6 +417,13 @@ @include assert-equal(render-node('.r .c_a'), (0, 0, 7.5, 0)); } + @include test('should layout node with stretch and child with margin') { + $global-frame-map: () !global; + .r { @include layout(( bottom: 5)); } + @include render-layout; + @include assert-equal(render-node('.r'), (0, 0, -5, 0)); + } + } @include report;