add isPointNotInRect
This commit is contained in:
parent
d6c717a73e
commit
c260027c9c
3 changed files with 9 additions and 12 deletions
|
@ -13,6 +13,7 @@ import {
|
|||
animateSlideInFromRight,
|
||||
animateSlideOutToRight,
|
||||
} from "~platform/anim";
|
||||
import { isPointNotInRect } from "~platform/dom";
|
||||
|
||||
export type BottomSheetProps = {
|
||||
open?: boolean;
|
||||
|
@ -120,12 +121,7 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
|||
event.stopPropagation();
|
||||
if (event.target !== event.currentTarget) return;
|
||||
const rect = event.currentTarget.getBoundingClientRect();
|
||||
const isNotInDialog =
|
||||
event.clientY < rect.top ||
|
||||
event.clientY > rect.bottom ||
|
||||
event.clientX < rect.left ||
|
||||
event.clientX > rect.right;
|
||||
if (isNotInDialog) {
|
||||
if (isPointNotInRect(rect, event.clientX, event.clientY)) {
|
||||
props.onClose?.("backdrop");
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue