From e13d30263140949e34857ea45caa9669237f70dc Mon Sep 17 00:00:00 2001 From: Tariq Soliman Date: Thu, 26 Sep 2024 18:12:43 -0700 Subject: [PATCH] #583 Starting in Point Mode for Time doesn't work (#589) --- src/essence/Ancillary/TimeUI.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/essence/Ancillary/TimeUI.js b/src/essence/Ancillary/TimeUI.js index 014a8284..33f1cb7b 100644 --- a/src/essence/Ancillary/TimeUI.js +++ b/src/essence/Ancillary/TimeUI.js @@ -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 @@ -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, }) @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 } @@ -1095,7 +1095,6 @@ const TimeUI = { TimeUI._endTimestamp != null ) { const mode = TimeUI.modes[TimeUI.modeIndex] - TimeUI.timeChange( new Date( mode === 'Range'