✨ 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
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
'use strict'
|
|
|
|
// limit of Crypto.getRandomValues()
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
|
|
var MAX_BYTES = 65536
|
|
|
|
// Node supports requesting up to this number of bytes
|
|
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
|
|
var MAX_UINT32 = 4294967295
|
|
|
|
function oldBrowser () {
|
|
throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
|
|
}
|
|
|
|
var Buffer = require('safe-buffer').Buffer
|
|
var crypto = global.crypto || global.msCrypto
|
|
|
|
if (crypto && crypto.getRandomValues) {
|
|
module.exports = randomBytes
|
|
} else {
|
|
module.exports = oldBrowser
|
|
}
|
|
|
|
function randomBytes (size, cb) {
|
|
// phantomjs needs to throw
|
|
if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
|
|
|
|
var bytes = Buffer.allocUnsafe(size)
|
|
|
|
if (size > 0) { // getRandomValues fails on IE if size == 0
|
|
if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
|
|
// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
|
|
for (var generated = 0; generated < size; generated += MAX_BYTES) {
|
|
// buffer.slice automatically checks if the end is past the end of
|
|
// the buffer so we don't have to here
|
|
crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
|
|
}
|
|
} else {
|
|
crypto.getRandomValues(bytes)
|
|
}
|
|
}
|
|
|
|
if (typeof cb === 'function') {
|
|
return process.nextTick(function () {
|
|
cb(null, bytes)
|
|
})
|
|
}
|
|
|
|
return bytes
|
|
}
|