Skip to content

Commit e13d302

Browse files
#583 Starting in Point Mode for Time doesn't work (#589)
1 parent 2bfd861 commit e13d302

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/essence/Ancillary/TimeUI.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ const TimeUI = {
156156
return { dateString, additionalSeconds }
157157
},
158158
attachEvents: function (timeChange) {
159-
let startingModeIndex = TimeUI.modeIndex
159+
TimeUI._startingModeIndex = TimeUI.modeIndex
160160
// Set modeIndex to 1/Point if a deeplink had an endtime but no starttime
161161
if (L_.FUTURES.startTime == null && L_.FUTURES.endTime != null)
162-
startingModeIndex = 1
162+
TimeUI._startingModeIndex = 1
163163

164164
// Timeline pan and zoom
165165
// zoom
@@ -355,11 +355,11 @@ const TimeUI = {
355355

356356
if (L_.configData.time?.startInPointMode == true) {
357357
TimeUI.modeIndex = TimeUI.modes.indexOf('Point')
358-
startingModeIndex = TimeUI.modeIndex
358+
TimeUI._startingModeIndex = TimeUI.modes.indexOf('Point')
359359
}
360360
// Mode dropdown
361361
$('#mmgisTimeUIModeDropdown').html(
362-
Dropy.construct(TimeUI.modes, 'Mode', startingModeIndex, {
362+
Dropy.construct(TimeUI.modes, 'Mode', TimeUI._startingModeIndex, {
363363
openUp: true,
364364
dark: true,
365365
})
@@ -521,12 +521,6 @@ const TimeUI = {
521521
null,
522522
true
523523
)
524-
525-
if (L_.configData.time?.startInPointMode == true)
526-
TimeUI.changeMode(TimeUI.modes.indexOf('Point'))
527-
// Set modeIndex to 1/Point if a deeplink had an endtime but no starttime
528-
else if (TimeUI.modeIndex != startingModeIndex)
529-
TimeUI.changeMode(startingModeIndex)
530524
},
531525
fina() {
532526
let date
@@ -579,6 +573,12 @@ const TimeUI = {
579573
if (TimeUI.enabled) {
580574
TimeUI._makeHistogram()
581575
}
576+
577+
if (L_.configData.time?.startInPointMode == true)
578+
TimeUI.changeMode(TimeUI.modes.indexOf('Point'))
579+
// Set modeIndex to 1/Point if a deeplink had an endtime but no starttime
580+
else if (TimeUI.modeIndex != TimeUI._startingModeIndex)
581+
TimeUI.changeMode(TimeUI._startingModeIndex)
582582
},
583583
changeMode(idx) {
584584
TimeUI.modeIndex = idx
@@ -710,6 +710,7 @@ const TimeUI = {
710710
_remakeTimeSlider(ignoreHistogram) {
711711
const rangeMode =
712712
TimeUI.modes[TimeUI.modeIndex] === 'Range' ? true : false
713+
713714
if (TimeUI.timeSlider) {
714715
TimeUI.timeSlider.$destroy()
715716
TimeUI.timeSlider = null
@@ -764,7 +765,6 @@ const TimeUI = {
764765
TimeUI.timeSlider.$on('change', (e) => {
765766
let idx = 0
766767
if (TimeUI.modes[TimeUI.modeIndex] === 'Point') idx -= 1
767-
768768
const date = new Date(e.detail.value)
769769
const offsetNowDate = new Date(
770770
date.getTime() + date.getTimezoneOffset() * 60000
@@ -953,7 +953,7 @@ const TimeUI = {
953953
if (parsedStart != null && parsedEnd != null) {
954954
if (offsetStartDate.getTime() > offsetEndDate.getTime()) {
955955
console.warn(
956-
`updateTimes: Cannot set start time after end time. ${parsedStart} > ${parseEnd}`
956+
`updateTimes: Cannot set start time after end time. ${parsedStart} > ${parsedEnd}`
957957
)
958958
return false
959959
}
@@ -1095,7 +1095,6 @@ const TimeUI = {
10951095
TimeUI._endTimestamp != null
10961096
) {
10971097
const mode = TimeUI.modes[TimeUI.modeIndex]
1098-
10991098
TimeUI.timeChange(
11001099
new Date(
11011100
mode === 'Range'

0 commit comments

Comments
 (0)