This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ink): add directive for applying ink to arbitrary elements
- not very sophisticated right now, just applies ink when clicked and emits "inked" event when the ink animation is done.
- Loading branch information
1 parent
9b5e355
commit 89819d5
Showing
2 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {ElementRef, Directive, Output, EventEmitter} from "angular2/core"; | ||
import {Ink} from "../../core/util/ink"; | ||
|
||
@Directive({ | ||
selector: '[md-ink]', | ||
host: { | ||
'(mousedown)': 'onMousedown($event)' | ||
}, | ||
}) | ||
export class MdInk { | ||
|
||
@Output() inked:EventEmitter<MdInk> = new EventEmitter<MdInk>(); | ||
|
||
constructor(private _element: ElementRef) { | ||
} | ||
|
||
onMousedown(event) { | ||
if (this._element && Ink.canApply(this._element.nativeElement)) { | ||
Ink.rippleEvent(this._element.nativeElement, event).then(() => { | ||
this.inked.emit(this); | ||
}); | ||
} | ||
} | ||
} |