Subscribe to the root menus mouse move events and update the tracked mouse points.
()
| 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 | /** |
no test coverage detected