Skip to content

Commit 6b52116

Browse files
authored
Merge pull request #59 from karpitony/dev
์œ„์น˜๋ฅผ ๋ฐ”๋กœ ํ‘œ์‹œํ•˜์ง€ ์•Š๋˜ ๋ฌธ์ œ, ์‹ ๋งต ์ถ”๊ฐ€
2 parents c7eab3e + 65c83b2 commit 6b52116

4 files changed

Lines changed: 317 additions & 56 deletions

File tree

โ€Žeft-where-am-i/Classes/Constants.csโ€Ž

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -608,22 +608,59 @@ function initMarkers() {
608608
(function() {
609609
'use strict';
610610
611+
// 1. ์›์น˜ ์•Š๋Š” ์š”์†Œ ์ œ๊ฑฐ
612+
// 1-1. ์ œ๊ฑฐํ•  ์š”์†Œ selector ๋ชฉ๋ก (๊ฐœ๋ฐœ์ž ๋„๊ตฌ์—์„œ selector ๋ณต์‚ฌํ•ด์„œ ์ถ”๊ฐ€)
613+
var selectors = [
614+
'#__nuxt > div > div > div.page-content > div > div > div.panel_right > div.user-layers-panel.mb-5.collapsed',
615+
'#__nuxt > div > div > div.page-content > div > div > div.panel_right > div.squad-panel.mb-5.collapsed',
616+
'#__nuxt > div > div > div.cookie-consent',
617+
'#__nuxt > div > div > div.footer-wrap',
618+
'#__nuxt > div > div > header'
619+
];
620+
621+
// 1-2. ๋“ฑ๋ก๋œ selector ์š”์†Œ ์ œ๊ฑฐ + ์˜ค๋ฒ„์Šคํฌ๋กค ์ฐจ๋‹จ
622+
function removeUnwantedElements() {
623+
for (var i = 0; i < selectors.length; i++) {
624+
var sel = selectors[i];
625+
try {
626+
document.querySelectorAll(sel).forEach(el => el.remove());
627+
} catch (e) {
628+
console.warn('[deadZoneAutoPan] Invalid selector:', sel, e);
629+
}
630+
}
631+
}
632+
removeUnwantedElements();
633+
634+
// 1-3. DOM ๋ณ€๊ฒฝ ๊ฐ์ง€ ์‹œ ์žฌ์‹คํ–‰ (debounced)
635+
var removeScheduled = false;
636+
var unwantedObserver = new MutationObserver(function() {
637+
if (removeScheduled) return;
638+
removeScheduled = true;
639+
requestAnimationFrame(function() {
640+
removeScheduled = false;
641+
removeUnwantedElements();
642+
});
643+
});
644+
if (document.body) {
645+
unwantedObserver.observe(document.body, { childList: true, subtree: true });
646+
}
647+
611648
window.__deadZoneAutoPan = function(deadZonePercent) {
612-
// 1. ๋งˆ์ปค ์ฐพ๊ธฐ
649+
// 2. ๋งˆ์ปค ์ฐพ๊ธฐ
613650
var markers = document.querySelectorAll('.marker');
614651
if (markers.length === 0) return JSON.stringify({ panned: false, reason: 'no-marker' });
615652
var marker = markers[markers.length - 1];
616653
var markerRect = marker.getBoundingClientRect();
617654
var markerCX = markerRect.left + markerRect.width / 2;
618655
var markerCY = markerRect.top + markerRect.height / 2;
619656
620-
// 2. ๋ทฐํฌํŠธ ๊ณ„์‚ฐ (#map์˜ ๋ถ€๋ชจ ๋˜๋Š” #map ์ž์ฒด)
657+
// 3. ๋ทฐํฌํŠธ ๊ณ„์‚ฐ (#map์˜ ๋ถ€๋ชจ ๋˜๋Š” #map ์ž์ฒด)
621658
var mapEl = document.querySelector('#map');
622659
if (!mapEl) return JSON.stringify({ panned: false, reason: 'no-map' });
623660
var viewportEl = mapEl.parentElement || mapEl;
624661
var viewportRect = viewportEl.getBoundingClientRect();
625662
626-
// 3. ํŒจ๋„ ๊ฐ์ง€ (tarkov-market ์‚ฌ์ด๋“œ ํŒจ๋„)
663+
// 4. ํŒจ๋„ ๊ฐ์ง€ (tarkov-market ์‚ฌ์ด๋“œ ํŒจ๋„)
627664
var effectiveLeft = viewportRect.left;
628665
var effectiveRight = viewportRect.right;
629666
var effectiveTop = viewportRect.top;
@@ -645,7 +682,7 @@ function initMarkers() {
645682
}
646683
}
647684
648-
// 4. deadZonePercent ๊ธฐ๋ฐ˜ ๋‚ด๋ถ€ ๊ฒฝ๊ณ„ ์‚ฌ๊ฐํ˜• ๊ณ„์‚ฐ
685+
// 5. deadZonePercent ๊ธฐ๋ฐ˜ ๋‚ด๋ถ€ ๊ฒฝ๊ณ„ ์‚ฌ๊ฐํ˜• ๊ณ„์‚ฐ
649686
var effectiveWidth = effectiveRight - effectiveLeft;
650687
var effectiveHeight = effectiveBottom - effectiveTop;
651688
var inset = (100 - deadZonePercent) / 200;
@@ -654,20 +691,20 @@ function initMarkers() {
654691
var boundTop = effectiveTop + effectiveHeight * inset;
655692
var boundBottom = effectiveBottom - effectiveHeight * inset;
656693
657-
// 5. ๋งˆ์ปค๊ฐ€ ๊ฒฝ๊ณ„ ์•ˆ์— ์žˆ์œผ๋ฉด ํŒฌ ๋ถˆํ•„์š”
694+
// 6. ๋งˆ์ปค๊ฐ€ ๊ฒฝ๊ณ„ ์•ˆ์— ์žˆ์œผ๋ฉด ํŒฌ ๋ถˆํ•„์š”
658695
if (markerCX >= boundLeft && markerCX <= boundRight &&
659696
markerCY >= boundTop && markerCY <= boundBottom) {
660697
return JSON.stringify({ panned: false, reason: 'inside-boundary' });
661698
}
662699
663-
// 6. ์ด๋™๋Ÿ‰ ๊ณ„์‚ฐ
700+
// 7. ์ด๋™๋Ÿ‰ ๊ณ„์‚ฐ
664701
var dx = 0, dy = 0;
665702
if (markerCX < boundLeft) dx = markerCX - boundLeft;
666703
else if (markerCX > boundRight) dx = markerCX - boundRight;
667704
if (markerCY < boundTop) dy = markerCY - boundTop;
668705
else if (markerCY > boundBottom) dy = markerCY - boundBottom;
669706
670-
// 7. pointer ์ด๋ฒคํŠธ ์‹œ๋ฎฌ๋ ˆ์ด์…˜์œผ๋กœ ๋งต ํŒฌ
707+
// 8. pointer ์ด๋ฒคํŠธ ์‹œ๋ฎฌ๋ ˆ์ด์…˜์œผ๋กœ ๋งต ํŒฌ
671708
var panTarget = mapEl.parentElement || mapEl;
672709
var startX = effectiveLeft + effectiveWidth / 2;
673710
var startY = effectiveTop + effectiveHeight / 2;

0 commit comments

Comments
ย (0)