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

Commit

Permalink
feat(button): adds attribute override for ripple size
Browse files Browse the repository at this point in the history
Closes #1088.
  • Loading branch information
Robert Messerle committed Jan 27, 2015
1 parent 03625c0 commit b7c43a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ angular.module('material.components.button', [
*
* @param {boolean=} md-no-ink If present, disable ripple ink effects.
* @param {expression=} ng-disabled En/Disable based on the expression
* @param {string=} md-ripple-size Overrides the default ripple size logic. Options: `full`, `partial`, `auto`
* @param {string=} aria-label Adds alternative text to button for accessibility, useful for icon buttons.
* If no default text is found, a warning will be logged.
*
Expand Down
12 changes: 11 additions & 1 deletion src/core/services/ripple/ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,18 @@ function InkRippleService($window, $timeout) {
isActive = false,
isHeld = false,
node = element[0],
rippleSizeSetting = element.attr('md-ripple-size'),
color = parseColor(element.attr('md-ink-ripple')) || parseColor($window.getComputedStyle(options.colorElement[0]).color || 'rgb(0, 0, 0)');

switch (rippleSizeSetting) {
case 'full':
options.isFAB = true;
break;
case 'partial':
options.isFAB = false;
break;
}

// expose onInput for ripple testing
if (options.mousedown) {
element.on('$md.pressdown', onPressDown)
Expand Down Expand Up @@ -272,7 +282,7 @@ function InkRippleService($window, $timeout) {
size = 2 * Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
} else {
multiplier = options.isFAB ? 1.1 : 0.8;
size = Math.max(width, height) * multiplier;
size = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)) * multiplier;
}
return size;
}
Expand Down

0 comments on commit b7c43a1

Please sign in to comment.