✨ 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
65 lines
2.4 KiB
JavaScript
65 lines
2.4 KiB
JavaScript
import { isScalar, isAlias, isSeq, isMap } from '../../nodes/identity.js';
|
|
import { Scalar } from '../../nodes/Scalar.js';
|
|
|
|
// If the value associated with a merge key is a single mapping node, each of
|
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
// already exists in it. If the value associated with the merge key is a
|
|
// sequence, then this sequence is expected to contain mapping nodes and each
|
|
// of these nodes is merged in turn according to its order in the sequence.
|
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
const MERGE_KEY = '<<';
|
|
const merge = {
|
|
identify: value => value === MERGE_KEY ||
|
|
(typeof value === 'symbol' && value.description === MERGE_KEY),
|
|
default: 'key',
|
|
tag: 'tag:yaml.org,2002:merge',
|
|
test: /^<<$/,
|
|
resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
|
|
addToJSMap: addMergeToJSMap
|
|
}),
|
|
stringify: () => MERGE_KEY
|
|
};
|
|
const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
(isScalar(key) &&
|
|
(!key.type || key.type === Scalar.PLAIN) &&
|
|
merge.identify(key.value))) &&
|
|
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
function addMergeToJSMap(ctx, map, value) {
|
|
value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
if (isSeq(value))
|
|
for (const it of value.items)
|
|
mergeValue(ctx, map, it);
|
|
else if (Array.isArray(value))
|
|
for (const it of value)
|
|
mergeValue(ctx, map, it);
|
|
else
|
|
mergeValue(ctx, map, value);
|
|
}
|
|
function mergeValue(ctx, map, value) {
|
|
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
if (!isMap(source))
|
|
throw new Error('Merge sources must be maps or map aliases');
|
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
for (const [key, value] of srcMap) {
|
|
if (map instanceof Map) {
|
|
if (!map.has(key))
|
|
map.set(key, value);
|
|
}
|
|
else if (map instanceof Set) {
|
|
map.add(key);
|
|
}
|
|
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
Object.defineProperty(map, key, {
|
|
value,
|
|
writable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
export { addMergeToJSMap, isMergeKey, merge };
|