Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#583 Starting in Point Mode for Time doesn't work #589

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading