Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(ripple): make checkbox only scale up to 1.0, looks good on ios
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Aug 30, 2014
1 parent a1c1a3e commit ed65da9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/components/animate/_effects.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ material-ink-bar {
opacity: 0.4;
}
50% {
@include transform(scale(2.7));
@include transform(scale(1.0));
opacity: 0.4;
}
100% {
@include transform(scale(2.7));
@include transform(scale(1.0));
opacity: 0;
}
}
Expand All @@ -53,6 +53,5 @@ material-ink-bar {
}

.material-ripple {
z-index: 0;
position: absolute;
}
9 changes: 4 additions & 5 deletions src/components/animate/inkCssRipple.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ function InkRippleService($window, $$rAF, $materialEffects, $timeout) {
return createRipple(ev.pageX, ev.pageY, true);
}
function createRipple(left, top, positionsAreAbsolute) {
var elementRect = node.getBoundingClientRect();
var elementStyle = $window.getComputedStyle(node);
var finalSize = elementRect.width;

var rippleEl = angular.element('<div class="material-ripple">')
.css(
Expand Down Expand Up @@ -156,15 +153,17 @@ function InkRippleService($window, $$rAF, $materialEffects, $timeout) {
left = rippleContainer.prop('offsetWidth') / 2;
top = rippleContainer.prop('offsetHeight') / 2;
} else if (positionsAreAbsolute) {
var elementRect = node.getBoundingClientRect();
left -= elementRect.left;
top -= elementRect.top;
}

var rippleStyle = $window.getComputedStyle(rippleEl[0]);
var finalSize = rippleContainer.prop('offsetWidth');

// TODO don't use px, make setRippleCss fix that
var css = {
'background-color': rippleStyle.color || elementStyle.color,
'background-color': $window.getComputedStyle(rippleEl[0]).color ||
$window.getComputedStyle(node).color,
'border-radius': (finalSize / 2) + 'px',

left: (left - finalSize / 2) + 'px',
Expand Down
8 changes: 4 additions & 4 deletions src/components/checkbox/_checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ material-checkbox {
.material-ripple-container {
position: absolute;
display: block;
width: 70px;
height: 70px;
left: -(35 - $checkbox-width / 2);
top: -(35 - $checkbox-width / 2);
width: $checkbox-width * 3;
height: $checkbox-width * 3;
left: -$checkbox-width;
top: -$checkbox-width;
}
.material-ripple {
color: #0f9d58;
Expand Down
8 changes: 4 additions & 4 deletions src/components/radioButton/_radio-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ material-radio-button,
.material-ripple-container {
position: absolute;
display: block;
width: 70px;
height: 70px;
left: -(35 - $radio-width / 2);
top: -(35 - $radio-width / 2);
width: $radio-width * 3;
height: $radio-width * 3;
left: -$radio-width;
top: -$radio-width;
}
.material-ripple {
color: #0f9d58;
Expand Down

0 comments on commit ed65da9

Please sign in to comment.