Added mixins lifted from FA, added rotations based on FA and existing functionality.

pull/82/head
Macdonald, Zak 9 years ago
parent a0703ba557
commit d1868e41c3

@ -0,0 +1,46 @@
// mixins lifted directly from FontAwesome
// -------------------------
@mixin wi-icon() {
display: inline-block;
font: normal normal normal #{$wi-font-size-base} / 1 WeatherIcons; // shortening font declaration
font-size: inherit; // can't have font-size inherit on line above, so need to override
text-rendering: auto; // optimizelegibility throws things off #1094
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0); // ensures no half-pixel rendering in firefox
}
@for $i from 0 through 270 {
@if $i == 0 or $i % 45 == 0 {
.#{$wi-css-prefix}-rotate-#{$i} {
wi-icon-rotate(#{$i})
}
}
}
@mixin wi-icon-rotate($degrees) {
@if $degrees == 0 or $degrees % 90 == 0 {
$rotation: $degrees / 90;
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation});
}
-webkit-transform: rotate(#{$degrees}deg);
-ms-transform: rotate(#{$degrees}deg);
transform: rotate(#{$degrees}deg);
}
@mixin wi-icon-flip($horiz, $vert, $rotation) {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation});
-webkit-transform: scale($horiz, $vert);
-ms-transform: scale($horiz, $vert);
transform: scale($horiz, $vert);
}

@ -0,0 +1,48 @@
// rotated and flipped icons
// -------------------------
$rotations-requiring-ie-fix: (
"flip-horizontal",
"flip-vertical"
);
$z: '';
@for $i from 0 through 359 {
@if $i == 0 or $i % $wi-rotate-by == 0 {
$Z: #{$wi-css-prefix}-rotate-#{$i};
.#{$z} {
@include wi-icon-rotate($i);
}
// check if this item needs
@if $i == 0 or $i % 90 == 0 {
$rotations-requiring-ie-fix: append($rotations-requiring-ie-fix, #{$z});
}
}
}
.#{$wi-css-prefix}-flip-horizontal { @include wi-icon-flip(-1, 1, 0); }
.#{$wi-css-prefix}-flip-vertical { @include wi-icon-flip(1, -1, 2); }
// ie 8-9 fix
// -------------------------
// todo: check on assigning an array of selectors to the selector instead of this
// unnecessary duplication of code
:root {
@each $fix in $rotations-requiring-ie-fix {
&.#{$fix} {
filter: none;
}
}
}

@ -4,6 +4,7 @@
$wi-font-path : "../fonts" !default;
$wi-font-size-base: 14px !default;
$wi-css-prefix : wi !default;
$wi-rotate-by : 45 !default;
$wi-version : "1.3.0" !default;
// $wi-border-color: #eee !default;
// $wi-inverse: #fff !default;

Loading…
Cancel
Save