- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/overlay.js
r59329aa re29cc2e 617 617 this._platform = _platform; 618 618 this._cursorStyleIsSet = false; 619 /** Store pointerdown event target to track origin of click. */ 620 this._pointerDownListener = (event) => { 621 this._pointerDownEventTarget = _getEventTarget(event); 622 }; 619 623 /** Click event listener that will be attached to the body propagate phase. */ 620 624 this._clickListener = (event) => { 621 625 const target = _getEventTarget(event); 626 // In case of a click event, we want to check the origin of the click 627 // (e.g. in case where a user starts a click inside the overlay and 628 // releases the click outside of it). 629 // This is done by using the event target of the preceding pointerdown event. 630 // Every click event caused by a pointer device has a preceding pointerdown 631 // event, unless the click was programmatically triggered (e.g. in a unit test). 632 const origin = event.type === 'click' && this._pointerDownEventTarget 633 ? this._pointerDownEventTarget : target; 634 // Reset the stored pointerdown event target, to avoid having it interfere 635 // in subsequent events. 636 this._pointerDownEventTarget = null; 622 637 // We copy the array because the original may be modified asynchronously if the 623 638 // outsidePointerEvents listener decides to detach overlays resulting in index errors inside … … 634 649 } 635 650 // If it's a click inside the overlay, just break - we should do nothing 636 // If it's an outside click dispatch the mouse event, and proceed with the next overlay 637 if (overlayRef.overlayElement.contains(target)) { 651 // If it's an outside click (both origin and target of the click) dispatch the mouse event, 652 // and proceed with the next overlay 653 if (overlayRef.overlayElement.contains(target) || 654 overlayRef.overlayElement.contains(origin)) { 638 655 break; 639 656 } … … 653 670 if (!this._isAttached) { 654 671 const body = this._document.body; 672 body.addEventListener('pointerdown', this._pointerDownListener, true); 655 673 body.addEventListener('click', this._clickListener, true); 656 674 body.addEventListener('auxclick', this._clickListener, true); … … 670 688 if (this._isAttached) { 671 689 const body = this._document.body; 690 body.removeEventListener('pointerdown', this._pointerDownListener, true); 672 691 body.removeEventListener('click', this._clickListener, true); 673 692 body.removeEventListener('auxclick', this._clickListener, true);
Note:
See TracChangeset
for help on using the changeset viewer.