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

Loading…
Cancel
Save