Skip to content

Commit

Permalink
fix(timeline): Reset layer status when selected layer is hidden in ti…
Browse files Browse the repository at this point in the history
…meline (#2109)
  • Loading branch information
Azurewarth0920 committed Feb 4, 2024
1 parent 990367e commit 8b6f96b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ export default defineComponent({
// Auto bottom scroll
function scrollToBottom () {
if (!scroller.value) return
requestAnimationFrame(() => {
if (!scroller.value) return
const scrollerEl = scroller.value.$el
scrollerEl.scrollTop = scrollerEl.scrollHeight
})
Expand Down
13 changes: 13 additions & 0 deletions packages/app-frontend/src/features/timeline/composable/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,22 @@ export function useLayers () {
return list.includes(layer.id)
}

function resetSelectedStatus () {
selectedLayer.value = null
inspectedEvent.value = null
selectedEvent.value = null
hoverLayerId.value = null
setStorage('selected-layer-id', '')
}

function setLayerHidden (layer: Layer, hidden: boolean) {
const list = getHiddenLayers(currentAppId.value)
const index = list.indexOf(layer.id)

if (selectedLayer.value === layer) {
resetSelectedStatus()
}

if (hidden && index === -1) {
list.push(layer.id)
} else if (!hidden && index !== -1) {
Expand Down

0 comments on commit 8b6f96b

Please sign in to comment.