✨ MAJOR FEATURES: • Auto-zoom intelligence với smart bounds fitting • Enhanced 3D GPS markers với pulsing effects • Professional route display với 6-layer rendering • Status-based parking icons với availability indicators • Production-ready build optimizations 🗺️ AUTO-ZOOM FEATURES: • Smart bounds fitting cho GPS + selected parking • Adaptive padding (50px) cho visual balance • Max zoom control (level 16) để tránh quá gần • Dynamic centering khi không có selection 🎨 ENHANCED VISUALS: • 3D GPS marker với multi-layer pulse effects • Advanced parking icons với status colors • Selection highlighting với animation • Dimming system cho non-selected items 🛣️ ROUTE SYSTEM: • OpenRouteService API integration • Multi-layer route rendering (glow, shadow, main, animated) • Real-time distance & duration calculation • Visual route info trong popup 📱 PRODUCTION READY: • SSR safe với dynamic imports • Build errors resolved • Global deployment via Vercel • Optimized performance 🌍 DEPLOYMENT: • Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app • Bundle size: 22.8 kB optimized • Global CDN distribution • HTTPS enabled 💾 VERSION CONTROL: • MapView-v2.0.tsx backup created • MAPVIEW_VERSIONS.md documentation • Full version history tracking
61 lines
2.6 KiB
JavaScript
61 lines
2.6 KiB
JavaScript
import { BLOCKED_PAGES } from "../shared/lib/constants";
|
|
export function isBlockedPage(page) {
|
|
return BLOCKED_PAGES.includes(page);
|
|
}
|
|
export function cleanAmpPath(pathname) {
|
|
if (pathname.match(/\?amp=(y|yes|true|1)/)) {
|
|
pathname = pathname.replace(/\?amp=(y|yes|true|1)&?/, "?");
|
|
}
|
|
if (pathname.match(/&=(y|yes|true|1)/)) {
|
|
pathname = pathname.replace(/&=(y|yes|true|1)/, "");
|
|
}
|
|
pathname = pathname.replace(/\?$/, "");
|
|
return pathname;
|
|
}
|
|
export function debounce(fn, ms, maxWait = Infinity) {
|
|
let timeoutId;
|
|
// The time the debouncing function was first called during this debounce queue.
|
|
let startTime = 0;
|
|
// The time the debouncing function was last called.
|
|
let lastCall = 0;
|
|
// The arguments and this context of the last call to the debouncing function.
|
|
let args, context;
|
|
// A helper used to that either invokes the debounced function, or
|
|
// reschedules the timer if a more recent call was made.
|
|
function run() {
|
|
const now = Date.now();
|
|
const diff = lastCall + ms - now;
|
|
// If the diff is non-positive, then we've waited at least `ms`
|
|
// milliseconds since the last call. Or if we've waited for longer than the
|
|
// max wait time, we must call the debounced function.
|
|
if (diff <= 0 || startTime + maxWait >= now) {
|
|
// It's important to clear the timeout id before invoking the debounced
|
|
// function, in case the function calls the debouncing function again.
|
|
timeoutId = undefined;
|
|
fn.apply(context, args);
|
|
} else {
|
|
// Else, a new call was made after the original timer was scheduled. We
|
|
// didn't clear the timeout (doing so is very slow), so now we need to
|
|
// reschedule the timer for the time difference.
|
|
timeoutId = setTimeout(run, diff);
|
|
}
|
|
}
|
|
return function(...passedArgs) {
|
|
// The arguments and this context of the most recent call are saved so the
|
|
// debounced function can be invoked with them later.
|
|
args = passedArgs;
|
|
context = this;
|
|
// Instead of constantly clearing and scheduling a timer, we record the
|
|
// time of the last call. If a second call comes in before the timer fires,
|
|
// then we'll reschedule in the run function. Doing this is considerably
|
|
// faster.
|
|
lastCall = Date.now();
|
|
// Only schedule a new timer if we're not currently waiting.
|
|
if (timeoutId === undefined) {
|
|
startTime = lastCall;
|
|
timeoutId = setTimeout(run, ms);
|
|
}
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=utils.js.map
|