Skip to content

Commit

Permalink
#583 Starting in Point Mode for Time doesn't work (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman authored Sep 27, 2024
1 parent 2bfd861 commit e13d302
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/essence/Ancillary/TimeUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ const TimeUI = {
return { dateString, additionalSeconds }
},
attachEvents: function (timeChange) {
let startingModeIndex = TimeUI.modeIndex
TimeUI._startingModeIndex = TimeUI.modeIndex
// Set modeIndex to 1/Point if a deeplink had an endtime but no starttime
if (L_.FUTURES.startTime == null && L_.FUTURES.endTime != null)
startingModeIndex = 1
TimeUI._startingModeIndex = 1

// Timeline pan and zoom
// zoom
Expand Down Expand Up @@ -355,11 +355,11 @@ const TimeUI = {

if (L_.configData.time?.startInPointMode == true) {
TimeUI.modeIndex = TimeUI.modes.indexOf('Point')
startingModeIndex = TimeUI.modeIndex
TimeUI._startingModeIndex = TimeUI.modes.indexOf('Point')
}
// Mode dropdown
$('#mmgisTimeUIModeDropdown').html(
Dropy.construct(TimeUI.modes, 'Mode', startingModeIndex, {
Dropy.construct(TimeUI.modes, 'Mode', TimeUI._startingModeIndex, {
openUp: true,
dark: true,
})
Expand Down Expand Up @@ -521,12 +521,6 @@ const TimeUI = {
null,
true
)

if (L_.configData.time?.startInPointMode == true)
TimeUI.changeMode(TimeUI.modes.indexOf('Point'))
// Set modeIndex to 1/Point if a deeplink had an endtime but no starttime
else if (TimeUI.modeIndex != startingModeIndex)
TimeUI.changeMode(startingModeIndex)
},
fina() {
let date
Expand Down Expand Up @@ -579,6 +573,12 @@ const TimeUI = {
if (TimeUI.enabled) {
TimeUI._makeHistogram()
}

if (L_.configData.time?.startInPointMode == true)
TimeUI.changeMode(TimeUI.modes.indexOf('Point'))
// Set modeIndex to 1/Point if a deeplink had an endtime but no starttime
else if (TimeUI.modeIndex != TimeUI._startingModeIndex)
TimeUI.changeMode(TimeUI._startingModeIndex)
},
changeMode(idx) {
TimeUI.modeIndex = idx
Expand Down Expand Up @@ -710,6 +710,7 @@ const TimeUI = {
_remakeTimeSlider(ignoreHistogram) {
const rangeMode =
TimeUI.modes[TimeUI.modeIndex] === 'Range' ? true : false

if (TimeUI.timeSlider) {
TimeUI.timeSlider.$destroy()
TimeUI.timeSlider = null
Expand Down Expand Up @@ -764,7 +765,6 @@ const TimeUI = {
TimeUI.timeSlider.$on('change', (e) => {
let idx = 0
if (TimeUI.modes[TimeUI.modeIndex] === 'Point') idx -= 1

const date = new Date(e.detail.value)
const offsetNowDate = new Date(
date.getTime() + date.getTimezoneOffset() * 60000
Expand Down Expand Up @@ -953,7 +953,7 @@ const TimeUI = {
if (parsedStart != null && parsedEnd != null) {
if (offsetStartDate.getTime() > offsetEndDate.getTime()) {
console.warn(
`updateTimes: Cannot set start time after end time. ${parsedStart} > ${parseEnd}`
`updateTimes: Cannot set start time after end time. ${parsedStart} > ${parsedEnd}`
)
return false
}
Expand Down Expand Up @@ -1095,7 +1095,6 @@ const TimeUI = {
TimeUI._endTimestamp != null
) {
const mode = TimeUI.modes[TimeUI.modeIndex]

TimeUI.timeChange(
new Date(
mode === 'Range'
Expand Down

0 comments on commit e13d302

Please sign in to comment.