Browse Source

비행승인 팝업 지정한 영역 들어올시 닫히는 기능 추가

master
김장현 3 months ago
parent
commit
15c854a307
  1. 29
      src/containers/flight/NewFlightApprovalsContainer.js

29
src/containers/flight/NewFlightApprovalsContainer.js

@ -131,28 +131,19 @@ export default function NewFlightApprovalsContainer({ mode }) {
}
if (savedRightMenuRef.current) {
console.log('@?@?@?');
// 부모 창의 특정 영역 (right-layer)의 위치와 크기
const specificArea = {
left: window.screenX + window.outerWidth - clientX, // 영역을 넓게 설정
right: window.screenX + window.outerWidth - clientX
};
console.log(specificArea);
// 팝업 창의 현재 위치
const popupRightEdge = popup.screenX + popup.outerWidth;
// window.screenX + window.outerWidth - e.clientX
console.log(popupRightEdge);
// console.log('Popup Position:', { popupLeft, popupTop });
if (
popupRightEdge >= specificArea.left &&
popupRightEdge <= specificArea.right
) {
const popupX = popup.screenX;
const parentX = window.screenX + savedRightMenuRef.current.left - 70;
const parentWidth = savedRightMenuRef.current.width;
if (popupX >= parentX && popupX <= parentX + parentWidth) {
popup.close();
setIsPopup(false);
clearInterval(timer);
}
}
}, 1000); // 1초마다 체크
}, 500); // 1초마다 체크
}
window.addEventListener('message', childMessage);
@ -189,7 +180,7 @@ export default function NewFlightApprovalsContainer({ mode }) {
// const popupY = Math.round(
// window.screenY + window.outerHeight / 2 - popupHeight / 2
// );
setClientX(window.screenX + window.outerWidth - e.clientX);
// setClientX(window.screenX + window.outerWidth - e.clientX);
const popupX =
window.screenX +
(window.outerWidth - popupWidth) / 2 +

Loading…
Cancel
Save