forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ripple): add option for persistent ripples
* Adds an option to the ripple service that allows persistent ripples (useful for focus indicators) * Manually launched ripples now return a `RippleRef` instance that can be used to to fade-out the ripples. * Adds a method to the component that developers to fade-out all currently active ripple elements. Closes angular#3169
- Loading branch information
1 parent
9cfe603
commit 0668879
Showing
15 changed files
with
160 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {ModuleWithProviders, NgModule} from '@angular/core'; | ||
import {MdRipple} from './ripple'; | ||
import {CompatibilityModule} from '../compatibility/compatibility'; | ||
import {VIEWPORT_RULER_PROVIDER} from '../overlay/position/viewport-ruler'; | ||
import {SCROLL_DISPATCHER_PROVIDER} from '../overlay/scroll/scroll-dispatcher'; | ||
|
||
export {MdRipple} from './ripple'; | ||
export {RippleRef} from './ripple-ref'; | ||
export {RippleConfig} from './ripple-renderer'; | ||
|
||
@NgModule({ | ||
imports: [CompatibilityModule], | ||
exports: [MdRipple, CompatibilityModule], | ||
declarations: [MdRipple], | ||
providers: [VIEWPORT_RULER_PROVIDER, SCROLL_DISPATCHER_PROVIDER], | ||
}) | ||
export class MdRippleModule { | ||
/** @deprecated */ | ||
static forRoot(): ModuleWithProviders { | ||
return { | ||
ngModule: MdRippleModule, | ||
providers: [] | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {RippleConfig, RippleRenderer} from './ripple-renderer'; | ||
|
||
/** | ||
* Reference to a previously launched ripple element. | ||
*/ | ||
export class RippleRef { | ||
|
||
constructor( | ||
private renderer: RippleRenderer, | ||
public element: HTMLElement, | ||
public config: RippleConfig) { | ||
} | ||
|
||
/** Fades out the ripple element. */ | ||
fadeOut() { | ||
let rippleIndex = this.renderer.activeRipples.indexOf(this); | ||
|
||
// Remove the ripple reference if added to the list of active ripples. | ||
if (rippleIndex !== -1) { | ||
this.renderer.activeRipples.splice(rippleIndex, 1); | ||
} | ||
|
||
// Regardless of being added to the list, fade-out the ripple element. | ||
this.renderer.fadeOutRipple(this.element); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.