Skip to content

Commit 9a66419

Browse files
committed
removed commented code
1 parent 31e98de commit 9a66419

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/components/Popup.astro

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212

1313
<script>
14-
// Initialize DOM elements using classes
14+
1515
const popup = document.querySelector(".state-popup") as HTMLElement;
1616
const popupStateName = document.querySelector(".state-popup__name") as HTMLElement;
1717
const popupStateInfo = document.querySelector(".state-popup__info") as HTMLElement;
@@ -39,45 +39,39 @@
3939
const popupWidth = popup.offsetWidth;
4040
const popupHeight = popup.offsetHeight;
4141

42-
// Get scroll position
4342
const scrollX = window.pageXOffset || document.documentElement.scrollLeft;
4443
const scrollY = window.pageYOffset || document.documentElement.scrollTop;
4544

46-
// Get click position relative to the page
4745
const clickX = event.pageX;
4846
const clickY = event.pageY;
4947

50-
// Calculate initial position (centered on click)
5148
let left = clickX - (popupWidth / 2);
5249
let top = clickY - (popupHeight / 2);
5350

54-
// Adjust horizontal position to keep within viewport
5551
if (left + popupWidth > viewportWidth + scrollX - 20) {
5652
left = viewportWidth + scrollX - popupWidth - 20;
5753
}
5854
if (left < scrollX + 20) {
5955
left = scrollX + 20;
6056
}
6157

62-
// Adjust vertical position to keep within viewport
6358
if (top + popupHeight > viewportHeight + scrollY - 20) {
6459
top = clickY - popupHeight - 20;
6560
}
6661
if (top < scrollY + 20) {
6762
top = scrollY + 20;
6863
}
6964

70-
// Apply the calculated position
7165
popup.style.left = `${left}px`;
7266
popup.style.top = `${top}px`;
7367

74-
// Make popup visible with transition
68+
7569
requestAnimationFrame(() => {
7670
popup.style.opacity = "1";
7771
});
7872
}
7973

80-
// Event Listeners
74+
8175
document.addEventListener("showStatePopup", ((e: CustomEvent) => {
8276
const { event, stateInfo } = e.detail;
8377
showPopup(event, stateInfo);

src/pages/map.astro

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
2-
// src/pages/index.astro
32
import BaseLayout from "@/layouts/Base";
4-
// import { Icon } from 'astro-icon/components'
53
import Popup from "@/components/Popup.astro";
64
import IndiaMap from "@/components/IndiaMap.astro";
75
import TitleLayout from "@/layouts/TitleLayout";
@@ -12,6 +10,4 @@ import "@/assets/styles/map_styles/popup.css";
1210
<TitleLayout title="Explore Dances of India" />
1311
<IndiaMap />
1412
<Popup />
15-
<!-- <Icon name="Andhra" /> -->
16-
1713
</BaseLayout>

0 commit comments

Comments
 (0)