✨ 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
82 lines
2.5 KiB
JavaScript
82 lines
2.5 KiB
JavaScript
import { Action } from './Action';
|
|
import { intervalProvider } from './intervalProvider';
|
|
import { arrRemove } from '../util/arrRemove';
|
|
export class AsyncAction extends Action {
|
|
constructor(scheduler, work) {
|
|
super(scheduler, work);
|
|
this.scheduler = scheduler;
|
|
this.work = work;
|
|
this.pending = false;
|
|
}
|
|
schedule(state, delay = 0) {
|
|
var _a;
|
|
if (this.closed) {
|
|
return this;
|
|
}
|
|
this.state = state;
|
|
const id = this.id;
|
|
const scheduler = this.scheduler;
|
|
if (id != null) {
|
|
this.id = this.recycleAsyncId(scheduler, id, delay);
|
|
}
|
|
this.pending = true;
|
|
this.delay = delay;
|
|
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
|
|
return this;
|
|
}
|
|
requestAsyncId(scheduler, _id, delay = 0) {
|
|
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
}
|
|
recycleAsyncId(_scheduler, id, delay = 0) {
|
|
if (delay != null && this.delay === delay && this.pending === false) {
|
|
return id;
|
|
}
|
|
if (id != null) {
|
|
intervalProvider.clearInterval(id);
|
|
}
|
|
return undefined;
|
|
}
|
|
execute(state, delay) {
|
|
if (this.closed) {
|
|
return new Error('executing a cancelled action');
|
|
}
|
|
this.pending = false;
|
|
const error = this._execute(state, delay);
|
|
if (error) {
|
|
return error;
|
|
}
|
|
else if (this.pending === false && this.id != null) {
|
|
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
}
|
|
}
|
|
_execute(state, _delay) {
|
|
let errored = false;
|
|
let errorValue;
|
|
try {
|
|
this.work(state);
|
|
}
|
|
catch (e) {
|
|
errored = true;
|
|
errorValue = e ? e : new Error('Scheduled action threw falsy error');
|
|
}
|
|
if (errored) {
|
|
this.unsubscribe();
|
|
return errorValue;
|
|
}
|
|
}
|
|
unsubscribe() {
|
|
if (!this.closed) {
|
|
const { id, scheduler } = this;
|
|
const { actions } = scheduler;
|
|
this.work = this.state = this.scheduler = null;
|
|
this.pending = false;
|
|
arrRemove(actions, this);
|
|
if (id != null) {
|
|
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
}
|
|
this.delay = null;
|
|
super.unsubscribe();
|
|
}
|
|
}
|
|
}
|
|
//# sourceMappingURL=AsyncAction.js.map
|