本文整理汇总了TypeScript中angular2/src/platform/dom/dom_adapter.DOM.getBoundingClientRect方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.getBoundingClientRect方法的具体用法?TypeScript DOM.getBoundingClientRect怎么用?TypeScript DOM.getBoundingClientRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/platform/dom/dom_adapter.DOM
的用法示例。
在下文中一共展示了DOM.getBoundingClientRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: rippleEvent
/**
* Start an ink ripple from a MouseEvent.
*
* @param element The element to ripple on.
* @param event The mouse event to indicate where the ripple should start at
* @returns {Promise<any>} A promise that resolves when the ripple has faded.
*/
static rippleEvent(element: HTMLElement, event: MouseEvent): Promise<any> {
let rippleX = event.offsetX;
let rippleY = event.offsetY;
if (element !== event.srcElement) {
let rect = DOM.getBoundingClientRect(element);
rippleX = event.clientX - rect.left;
rippleY = event.clientY - rect.top;
}
return Ink.ripple(element, rippleX, rippleY);
}