MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / initSheetGesture

Method initSheetGesture

core/src/components/modal/modal.tsx:765–819  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

763 }
764
765 private initSheetGesture() {
766 const { wrapperEl, initialBreakpoint, backdropBreakpoint } = this;
767
768 if (!wrapperEl || initialBreakpoint === undefined) {
769 return;
770 }
771
772 const animationBuilder = this.enterAnimation || config.get('modalEnter', iosEnterAnimation);
773 const ani: Animation = (this.animation = animationBuilder(this.el, {
774 presentingEl: this.presentingElement,
775 currentBreakpoint: initialBreakpoint,
776 backdropBreakpoint,
777 expandToScroll: this.expandToScroll,
778 }));
779
780 ani.progressStart(true, 1);
781
782 const { gesture, moveSheetToBreakpoint } = createSheetGesture(
783 this.el,
784 this.backdropEl!,
785 wrapperEl,
786 initialBreakpoint,
787 backdropBreakpoint,
788 ani,
789 this.sortedBreakpoints,
790 this.expandToScroll,
791 () => this.currentBreakpoint ?? 0,
792 () => this.sheetOnDismiss(),
793 (breakpoint: number) => {
794 if (this.currentBreakpoint !== breakpoint) {
795 this.currentBreakpoint = breakpoint;
796 this.ionBreakpointDidChange.emit({ breakpoint });
797 }
798 },
799 () => this.onDragStart(),
800 (detail: ModalDragEventDetail) => this.onDragMove(detail),
801 (detail: ModalDragEventDetail) => this.onDragEnd(detail)
802 );
803
804 this.gesture = gesture;
805 this.moveSheetToBreakpoint = moveSheetToBreakpoint;
806
807 this.gesture.enable(true);
808
809 /**
810 * When backdrop interaction is allowed, nested router outlets from child routes
811 * may block pointer events to parent content. Apply passthrough styles only when
812 * the modal was the sole content of a child route page.
813 * See https://github.com/ionic-team/ionic-framework/issues/30700
814 */
815 const backdropNotBlocking = this.showBackdrop === false || this.focusTrap === false || backdropBreakpoint > 0;
816 if (backdropNotBlocking) {
817 this.setupChildRoutePassthrough();
818 }
819 }
820
821 /**
822 * For sheet modals that allow background interaction, sets up pointer-events

Callers 1

presentMethod · 0.95

Calls 9

sheetOnDismissMethod · 0.95
onDragStartMethod · 0.95
onDragMoveMethod · 0.95
onDragEndMethod · 0.95
createSheetGestureFunction · 0.90
progressStartMethod · 0.80
getMethod · 0.65
enableMethod · 0.65

Tested by

no test coverage detected