i really don't want to keep on working on scroll forever
This commit is contained in:
parent
24b7335903
commit
05824010ed
4 changed files with 116 additions and 103 deletions
|
|
@ -116,6 +116,7 @@ export default {
|
|||
fetchConversation,
|
||||
loadError,
|
||||
} = useConversation(statusId, isExpanded)
|
||||
const conversationLite = computed(() => conversation.value.map(({ id }) => ({ id })))
|
||||
|
||||
watch(
|
||||
expanded,
|
||||
|
|
@ -137,10 +138,10 @@ export default {
|
|||
const lastStatus = computed(
|
||||
() => conversation.value[conversation.value.legnth - 1],
|
||||
)
|
||||
const getStatusClasses = (status, ancestor) => {
|
||||
const getStatusClasses = (statusId, ancestor) => {
|
||||
const result = {
|
||||
'-first': status.id === firstStatus.value?.id,
|
||||
'-last': status.id === lastStatus.value?.id,
|
||||
'-first': statusId === firstStatus.value?.id,
|
||||
'-last': statusId === lastStatus.value?.id,
|
||||
}
|
||||
if (ancestor) {
|
||||
result['-ancestor'] = true
|
||||
|
|
@ -191,12 +192,15 @@ export default {
|
|||
heightChart: heightChartLinear,
|
||||
changeSuspendState: changeSuspendStateLinear,
|
||||
updateVirtualHeight: updateVirtualHeightLinear,
|
||||
reset: resetLinearScrollVirtualization,
|
||||
} = useVirtualScrolling({
|
||||
list: conversation,
|
||||
context: statusId,
|
||||
list: conversationLite,
|
||||
body: linearElement,
|
||||
scrollPositionInstance: scroller,
|
||||
scrollCompensation: linearScrollCompensation,
|
||||
anchorIds,
|
||||
collapseMode: 'item',
|
||||
getPlaceholderHeight,
|
||||
})
|
||||
const changeSuspendStateLinearLocal = (e) => {
|
||||
|
|
@ -227,14 +231,17 @@ export default {
|
|||
{ flush: 'post' },
|
||||
)
|
||||
|
||||
const currentAncestorsLite = computed(() => currentAncestors.value.map(({ id }) => ({ id })))
|
||||
const ancestorsElement = useTemplateRef('ancestors')
|
||||
const treeScrollCompensation = computed(() => isTreeView.value)
|
||||
const {
|
||||
heightChart: heightChartAncestors,
|
||||
changeSuspendState: changeSuspendStateAncestors,
|
||||
updateVirtualHeight: updateVirtualHeightAncestors,
|
||||
reset: resetTreeScrollVirtualization,
|
||||
} = useVirtualScrolling({
|
||||
list: currentAncestors,
|
||||
context: statusId,
|
||||
list: currentAncestorsLite,
|
||||
body: ancestorsElement,
|
||||
scrollPositionInstance: scroller,
|
||||
scrollCompensation: treeScrollCompensation,
|
||||
|
|
@ -260,6 +267,11 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
watch(statusId, (neu, old) => {
|
||||
resetLinearScrollVirtualization()
|
||||
resetTreeScrollVirtualization()
|
||||
})
|
||||
|
||||
const treeViewIsSimple = computed(
|
||||
() => !mergedConfig.value.conversationTreeAdvanced,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -98,19 +98,19 @@
|
|||
<Status
|
||||
v-if="element.type === 'item'"
|
||||
class="conversation-status panel-body"
|
||||
:class="getStatusClasses(element.item, true)"
|
||||
:class="getStatusClasses(element.id, true)"
|
||||
|
||||
:status-id="element.item.id"
|
||||
:replies="getReplies(element.item.id)"
|
||||
:status-id="element.id"
|
||||
:replies="getReplies(element.id)"
|
||||
|
||||
:focused="focusedId === element.item.id"
|
||||
:focused="focusedId === element.id"
|
||||
conversation-rank="ancestor"
|
||||
:data-status-id="element.id"
|
||||
:data-vs-height="element.height"
|
||||
:data-vs-top="element.top"
|
||||
|
||||
@goto="setFocused"
|
||||
@dive="diveIntoStatus(element.item.id)"
|
||||
@dive="diveIntoStatus(element.id)"
|
||||
@suspendable-state-change="changeSuspendStateAncestorsLocal"
|
||||
@height-change="updateVirtualHeightAncestors"
|
||||
/>
|
||||
|
|
@ -145,11 +145,11 @@
|
|||
<Status
|
||||
v-if="element.type === 'item'"
|
||||
class="panel-body conversation-status"
|
||||
:class="getStatusClasses(element.item)"
|
||||
:status-id="element.item.id"
|
||||
:replies="getReplies(element.item.id)"
|
||||
:class="getStatusClasses(element.id)"
|
||||
:status-id="element.id"
|
||||
:replies="getReplies(element.id)"
|
||||
|
||||
:focused="focusedId === element.item.id || focusedId === element.item.retweeted_status?.id"
|
||||
:focused="focusedId === element.id"
|
||||
|
||||
:data-status-id="element.id"
|
||||
:data-vs-height="element.height"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue