mat-ripple
Version:
Material design Ripple effect.
55 lines (54 loc) • 2.58 kB
TypeScript
import { RippleRef } from './ripple-ref';
import { RippleTarget } from './Interfaces';
import { RippleConfig } from './Types';
/**
* Helper service that performs DOM manipulations. Not intended to be used outside this module.
* The constructor takes a reference to the ripple host element and a map of DOM
* event handlers to be installed on the element that triggers ripple animations.
*/
export declare class RippleRenderer {
private _target;
constructor(_target: RippleTarget, elementRef: HTMLElement, pathElement: any);
/** Element where the ripples are being added to. */
private _containerElement;
/** Element which triggers the ripple elements on mouse events. */
private _triggerElement;
/** Whether the pointer is currently down or not. */
private _isPointerDown;
/** Events to be registered on the trigger element. */
private _triggerEvents;
/** Set of currently active ripple references. */
private _activeRipples;
/** Latest non-persistent ripple that was triggered. */
private _mostRecentTransientRipple;
/** Time in milliseconds when the last touchstart event happened. */
private _lastTouchStartEvent;
/**
* Cached dimensions of the ripple container. Set when the first
* ripple is shown and cleared once no more ripples are visible.
*/
private _containerRect;
/** Element where the ripples are being added to. */
private _pathElement;
/**
* Fades in a ripple at the given coordinates.
* @param x Coordinate within the element, along the X axis at which to start the ripple.
* @param y Coordinate within the element, along the Y axis at which to start the ripple.
* @param config Extra ripple options.
*/
fadeInRipple(x: number, y: number, config?: RippleConfig): RippleRef;
/** Fades out a ripple reference. */
fadeOutRipple(rippleRef: RippleRef): void;
/** Fades out all currently active ripples. */
fadeOutAll(): void;
/** Sets up the trigger event listeners */
setupTriggerEvents(element: HTMLElement): void;
/** Removes previously registered event listeners from the trigger element. */
removeTriggerEvents(): void;
/** Function being called whenever the trigger is being pressed using mouse. */
private _onMousedown;
/** Function being called whenever the trigger is being pressed using touch. */
private _onTouchStart;
/** Function being called whenever the trigger is being released. */
private _onPointerUp;
}