Skip to content

Commit

Permalink
#460 Fix Time Vector Layer first turn on (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman authored Dec 6, 2023
1 parent 5946dff commit c0f7a35
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/essence/Basics/Layers_/Layers_.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ const L_ = {
//Takes in a config layer object
toggleLayer: async function (s) {
if (s == null) return

const wasNeverOn = L_.layers.layer[s.name] === false

let on //if on -> turn off //if off -> turn on
if (L_.layers.on[s.name] === true) on = true
else on = false
Expand All @@ -236,6 +239,21 @@ const L_ = {
if (L_.activeFeature && L_.activeFeature.layerName === s.name && on) {
L_.setActiveFeature(null)
}

// Make new vector layer match time constraints
if (
wasNeverOn &&
s.type === 'vector' &&
s.time.type === 'local' &&
s.time.endProp != null &&
s.controlled !== true
) {
L_.timeFilterVectorLayer(
s.name,
new Date(s.time.start).getTime(),
new Date(s.time.end).getTime()
)
}
},
toggleLayerHelper: async function (
s,
Expand Down Expand Up @@ -471,6 +489,7 @@ const L_ = {
L_._layersOrdered.indexOf(s.name)
)
}

if (s.type === 'vector') {
L_.Globe_.litho.addLayer(
s.layer3dType || 'clamped',
Expand Down

0 comments on commit c0f7a35

Please sign in to comment.