浏览代码

fix the restore issue # 50

tags/2.4.0
Caven Chen 4 年前
父节点
当前提交
5aba3b02dc
共有 2 个文件被更改,包括 15 次插入15 次删除
  1. 14
    14
      modules/history-track/Track.js
  2. 1
    1
      modules/history-track/TrackController.js

+ 14
- 14
modules/history-track/Track.js 查看文件

@@ -271,18 +271,20 @@ class Track {
return false
}
let interval = 0
let v = distance(this._positions) / this._duration
this._timeLine = this._positions.map((item, index, arr) => {
if (index !== 0) {
interval += distance([arr[index - 1], item]) / v
}
return Cesium.JulianDate.addSeconds(
this._startTime,
interval,
new Cesium.JulianDate()
)
})
if (params?.stopTime && params?.duration) {
if (!params?.stopTime && !params?.duration) {
let v = distance(this._positions) / this._duration
this._timeLine = this._positions.map((item, index, arr) => {
if (index !== 0) {
interval += distance([arr[index - 1], item]) / v
}
return Cesium.JulianDate.addSeconds(
this._startTime,
interval,
new Cesium.JulianDate()
)
})
this._pathPositions = []
} else if (params?.stopTime && params?.duration) {
this._duration += params.duration
this._timeLine = this._timeLine.map(item => {
if (Cesium.JulianDate.greaterThan(item, params.stopTime)) {
@@ -294,8 +296,6 @@ class Track {
}
return item
})
} else {
this._pathPositions = []
}
this._sampledPosition = new Cesium.SampledPositionProperty()
this._sampledPosition.addSamples(

+ 1
- 1
modules/history-track/TrackController.js 查看文件

@@ -147,7 +147,7 @@ class TrackController {
let track = this._cache[key]
track.trackEvent.fire(TrackEventType.RESET_TIME_LINE, {
stopTime: this._stopTime,
duration: Cesium.JulianDate.secondsDifference(this._stopTime, now)
duration: Cesium.JulianDate.secondsDifference(now, this._stopTime)
})
})
}

正在加载...
取消
保存