@besovideo/bvmap-leaflet 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +58 -13
- package/dist/main.js.map +1 -1
- package/dist/types/basemap/trackPlayback/index.d.ts +6 -0
- package/package.json +46 -46
package/dist/main.js
CHANGED
|
@@ -10361,7 +10361,37 @@ class Ah {
|
|
|
10361
10361
|
}
|
|
10362
10362
|
class Ih {
|
|
10363
10363
|
constructor(i) {
|
|
10364
|
-
this.baseline = new Sh(), this.timeCallback = null, this._currentPoints = null, this.intervalToken = null, this.pastTimeTotal = 0, this.startTime = 0, this.bPause = !
|
|
10364
|
+
this.baseline = new Sh(), this.timeCallback = null, this._currentPoints = null, this.intervalToken = null, this.pastTimeTotal = 0, this.startTime = 0, this.bPause = !0, this.playSegments = [], this.playStartTrackTime = 0, this.fastModeTotalDuration = 0, this.fastModePlayTime = 0, this.playRate = 1, this.baseline.addTo(i), this.passedLine = new Ah(i), this.map = i, this.applyRotation();
|
|
10365
|
+
}
|
|
10366
|
+
buildPlaySegments(i) {
|
|
10367
|
+
this.playSegments = [];
|
|
10368
|
+
for (let n = 0; n < i.length - 1; n++) {
|
|
10369
|
+
const r = i[n].time, l = i[n + 1].time, a = l - r;
|
|
10370
|
+
let h = a;
|
|
10371
|
+
this.playRate !== 1 && a > 30 && (h = 30), this.playSegments.push({
|
|
10372
|
+
startTime: r,
|
|
10373
|
+
endTime: l,
|
|
10374
|
+
playDuration: h
|
|
10375
|
+
});
|
|
10376
|
+
}
|
|
10377
|
+
}
|
|
10378
|
+
mapPlayTimeToTrackTime(i) {
|
|
10379
|
+
if (this.playRate === 64 && this.fastModeTotalDuration > 0) {
|
|
10380
|
+
const l = Math.min(i, 30) / 30;
|
|
10381
|
+
return this.playStartTrackTime + this.fastModeTotalDuration * l;
|
|
10382
|
+
}
|
|
10383
|
+
let n = 0;
|
|
10384
|
+
for (const r of this.playSegments) {
|
|
10385
|
+
if (r.endTime <= this.playStartTrackTime)
|
|
10386
|
+
continue;
|
|
10387
|
+
const l = r.startTime < this.playStartTrackTime ? this.playStartTrackTime : r.startTime, a = r.endTime - l, h = r.playDuration * (a / (r.endTime - r.startTime));
|
|
10388
|
+
if (i <= n + h) {
|
|
10389
|
+
const u = h === 0 ? 0 : (i - n) / h;
|
|
10390
|
+
return l + a * u;
|
|
10391
|
+
}
|
|
10392
|
+
n += h;
|
|
10393
|
+
}
|
|
10394
|
+
return this.playSegments.length ? this.playSegments[this.playSegments.length - 1].endTime : 0;
|
|
10365
10395
|
}
|
|
10366
10396
|
applyRotation() {
|
|
10367
10397
|
this.map.addEventListener("zoomed", () => {
|
|
@@ -10382,7 +10412,7 @@ class Ih {
|
|
|
10382
10412
|
toolTipNeedUpdate: (l, a, h) => {
|
|
10383
10413
|
i.toolTipNeedUpdate({ id: i.id }, l, a, h);
|
|
10384
10414
|
}
|
|
10385
|
-
}), this.passedLine.SetPoints(i, n), this._currentPoints = n, n.length)
|
|
10415
|
+
}), this.passedLine.SetPoints(i, n), this._currentPoints = n, n.length > 1 && (this.fastModeTotalDuration = n[n.length - 1].time - n[0].time), this.buildPlaySegments(n), n.length)
|
|
10386
10416
|
try {
|
|
10387
10417
|
this.map.fitBounds(this.baseline.getBounds());
|
|
10388
10418
|
} catch (l) {
|
|
@@ -10403,18 +10433,24 @@ class Ih {
|
|
|
10403
10433
|
}
|
|
10404
10434
|
jump(i) {
|
|
10405
10435
|
var n;
|
|
10436
|
+
if (this.playRate === 64)
|
|
10437
|
+
return !1;
|
|
10406
10438
|
if (i && this._currentPoints) {
|
|
10407
10439
|
if (i < this._currentPoints[0].time || i > this._currentPoints[this._currentPoints.length - 1].time)
|
|
10408
10440
|
return !1;
|
|
10409
10441
|
{
|
|
10410
|
-
this.startTime = i, this.pastTimeTotal = 0;
|
|
10442
|
+
this.startTime = i, this.playStartTrackTime = i, this.pastTimeTotal = 0;
|
|
10411
10443
|
const [r, l] = this.passedLine.SetCurrentTime(i);
|
|
10412
10444
|
(n = this.timeCallback) == null || n.call(this, i, r, l);
|
|
10413
10445
|
}
|
|
10414
10446
|
}
|
|
10415
10447
|
}
|
|
10416
10448
|
StartTrackPlay(i) {
|
|
10417
|
-
this.bPause && this.intervalToken
|
|
10449
|
+
if (this.bPause && this.intervalToken) {
|
|
10450
|
+
this.bPause = !1;
|
|
10451
|
+
return;
|
|
10452
|
+
}
|
|
10453
|
+
i && this._currentPoints && i < this._currentPoints[0].time && (i = this._currentPoints[0].time), this.pastTimeTotal = 0, i && (this.startTime = i, this.playStartTrackTime = i), this.startTime === 0 && this._currentPoints && (this.startTime = this._currentPoints[0].time, this.playStartTrackTime = this.startTime), this.startInterval();
|
|
10418
10454
|
}
|
|
10419
10455
|
startInterval() {
|
|
10420
10456
|
if (this._currentPoints && this.intervalToken == null) {
|
|
@@ -10423,17 +10459,19 @@ class Ih {
|
|
|
10423
10459
|
const n = this._currentPoints[this._currentPoints.length - 1].time;
|
|
10424
10460
|
let r = 0;
|
|
10425
10461
|
this.intervalToken = setInterval(() => {
|
|
10426
|
-
var
|
|
10462
|
+
var f;
|
|
10427
10463
|
if (this.bPause) {
|
|
10428
10464
|
i = Date.now();
|
|
10429
10465
|
return;
|
|
10430
10466
|
}
|
|
10431
|
-
const l = Date.now(), a = (l - i)
|
|
10432
|
-
i = l
|
|
10433
|
-
let h =
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10467
|
+
const l = Date.now(), a = (l - i) / 1e3;
|
|
10468
|
+
i = l;
|
|
10469
|
+
let h = 0;
|
|
10470
|
+
this.playRate === 64 ? (this.fastModePlayTime += a, h = this.mapPlayTimeToTrackTime(this.fastModePlayTime)) : (this.pastTimeTotal += a * this.playRate, h = this.mapPlayTimeToTrackTime(this.pastTimeTotal)), h > n && (h = n);
|
|
10471
|
+
const u = Math.floor(h);
|
|
10472
|
+
if (r != u) {
|
|
10473
|
+
const [m, v] = this.passedLine.SetCurrentTime(u);
|
|
10474
|
+
(f = this.timeCallback) == null || f.call(this, u, m, v), r = u;
|
|
10437
10475
|
}
|
|
10438
10476
|
}, 500);
|
|
10439
10477
|
}
|
|
@@ -10445,10 +10483,17 @@ class Ih {
|
|
|
10445
10483
|
this.bPause = !0;
|
|
10446
10484
|
}
|
|
10447
10485
|
SetPlayRate(i) {
|
|
10448
|
-
|
|
10486
|
+
var a, h;
|
|
10487
|
+
const n = this.bPause;
|
|
10488
|
+
if (i < 1 || i > 64 || Math.floor(i) !== i) return;
|
|
10489
|
+
const r = this.playRate, l = r === 64 && i !== 64 || r !== 64 && i === 64;
|
|
10490
|
+
if (this.playRate = i, this._currentPoints && this._currentPoints.length > 1 && this.buildPlaySegments(this._currentPoints), l && ((a = this._currentPoints) != null && a.length)) {
|
|
10491
|
+
const u = this._currentPoints[0].time;
|
|
10492
|
+
this.stoptInterval(), this.pastTimeTotal = 0, this.fastModePlayTime = 0, this.startTime = u, this.playStartTrackTime = u, this.passedLine.clearPassedLine(), this.passedLine.SetCurrentTime(u), (h = this.timeCallback) == null || h.call(this, u, 0, 1), n ? this.bPause = !0 : this.startInterval();
|
|
10493
|
+
}
|
|
10449
10494
|
}
|
|
10450
10495
|
clear() {
|
|
10451
|
-
this.baseline.clearBaseline(), this.passedLine.clearPassedLine(), this.stoptInterval(), this.bPause = !
|
|
10496
|
+
this.baseline.clearBaseline(), this.passedLine.clearPassedLine(), this.stoptInterval(), this.bPause = !0, this.startTime = 0, this._currentPoints = null;
|
|
10452
10497
|
}
|
|
10453
10498
|
setFitView(i) {
|
|
10454
10499
|
this.map.fitBounds(this.baseline.getBounds());
|