MCPcopy Create free account
hub / github.com/angular/components / _subscribeToMouseMoves

Method _subscribeToMouseMoves

src/cdk/menu/menu-aim.ts:242–258  ·  view source on GitHub ↗

Subscribe to the root menus mouse move events and update the tracked mouse points.

()

Source from the content-addressed store, hash-verified

240
241 /** Subscribe to the root menus mouse move events and update the tracked mouse points. */
242 private _subscribeToMouseMoves() {
243 this._cleanupMousemove?.();
244
245 this._cleanupMousemove = this._ngZone.runOutsideAngular(() => {
246 let eventIndex = 0;
247
248 return this._renderer.listen(this._menu.nativeElement, 'mousemove', (event: MouseEvent) => {
249 if (eventIndex % MOUSE_MOVE_SAMPLE_FREQUENCY === 0) {
250 this._points.push({x: event.clientX, y: event.clientY});
251 if (this._points.length > NUM_POINTS) {
252 this._points.shift();
253 }
254 }
255 eventIndex++;
256 });
257 });
258 }
259}
260
261/**

Callers 1

initializeMethod · 0.95

Calls 2

listenMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected