Skip to content

Commit

Permalink
refreshLayer to work with dynamicExtent
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Oct 21, 2024
1 parent 5ade405 commit ae6d707
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions src/essence/Basics/Map_/Map_.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,21 @@ let Map_ = {
}
},
refreshLayer: async function (layerObj, cb, skipOrderedBringToFront) {
// If it's a dynamic extent layer, just re-call its function
if (
L_._onSpecificLayerToggleSubscriptions[
`dynamicextent_${layerObj.name}`
] != null
) {
if (L_.layers.on[layerObj.name])
L_._onSpecificLayerToggleSubscriptions[
`dynamicextent_${layerObj.name}`
].func(layerObj.name)

if (typeof cb === 'function') cb()
return true
}

// We need to find and remove all points on the map that belong to the layer
// Not sure if there is a cleaner way of doing this
for (var i = L_._layersOrdered.length - 1; i >= 0; i--) {
Expand All @@ -406,11 +421,13 @@ let Map_ = {
) {
if (L_._layersBeingMade[layerObj.name] !== true) {
const wasOn = L_.layers.on[layerObj.name]

if (wasOn)
L_.toggleLayer(
L_.layers.data[layerObj.name],
skipOrderedBringToFront
) // turn off if on

// fake on
L_.layers.on[layerObj.name] = true
await makeLayer(layerObj, true, null)
Expand Down Expand Up @@ -801,11 +818,11 @@ async function makeVectorLayer(
layerObj.controlled !== true
)
L_.subscribeTimeChange(
`dynamicgeodataset_${layerObj.name}`,
`dynamicextent_${layerObj.name}`,
f
)
L_.subscribeOnSpecificLayerToggle(
`dynamicgeodataset_${layerObj.name}`,
`dynamicextent_${layerObj.name}`,
layerObj.name,
f
)
Expand Down

0 comments on commit ae6d707

Please sign in to comment.