Fixed bugs with sizing, added some attributions.
parent
004a98ca2b
commit
2f876ce97f
@ -1,7 +1,39 @@
|
||||
// functions
|
||||
// --------------------------
|
||||
|
||||
@function strip-units($number) {
|
||||
// extract the number from a unit
|
||||
@function unitless($number) {
|
||||
|
||||
@return $number / ($number * 0 + 1);
|
||||
}
|
||||
|
||||
// fudge a number to an accuracy of n <= 6 decimal places
|
||||
@function fudge($number, $places: 0) {
|
||||
|
||||
$fraction: 10;
|
||||
$number: unitless($number);
|
||||
$return: null;
|
||||
|
||||
@if $places == 0 {
|
||||
|
||||
@return round($number);
|
||||
|
||||
} @else {
|
||||
|
||||
@if $places > 6 {
|
||||
|
||||
$places: 6;
|
||||
}
|
||||
|
||||
// how sweet life could be with some simple trig... no loop necessary
|
||||
// $fraction: (10 ^ $places);
|
||||
// @return round($number * $fraction) / $fraction;
|
||||
|
||||
@for $i from 1 through $places {
|
||||
|
||||
$fraction: $fraction * 10;
|
||||
}
|
||||
|
||||
@return round($number * $fraction) / $fraction;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue