Fix bug with scroll arrows
This commit is contained in:
parent
6da8907816
commit
770dbc94ea
|
|
@ -2,7 +2,7 @@
|
|||
import LearningPathCircleColumn from "@/pages/learningPath/learningPathPage/LearningPathCircleColumn.vue";
|
||||
import LearningPathScrollButton from "@/pages/learningPath/learningPathPage/LearningPathScrollButton.vue";
|
||||
import { useScroll } from "@vueuse/core";
|
||||
import { ref } from "vue";
|
||||
import { nextTick, ref, watch } from "vue";
|
||||
import type {
|
||||
LearningContentWithCompletion,
|
||||
LearningPathType,
|
||||
|
|
@ -40,7 +40,6 @@ const scrollLearnPathDiagram = (offset: number) => {
|
|||
};
|
||||
|
||||
const filterCircles = (topic: TopicType) => {
|
||||
// return [];
|
||||
if (props.filter === undefined || props.filter === "") {
|
||||
return topic.circles;
|
||||
}
|
||||
|
|
@ -49,6 +48,17 @@ const filterCircles = (topic: TopicType) => {
|
|||
circle.profiles.indexOf(props.filter as string) > -1 || circle.is_base_circle
|
||||
);
|
||||
};
|
||||
|
||||
watch(()=> props.filter, () => {
|
||||
// we need to update the scroll state of the element, otherwise the arrows won't match the scroll state
|
||||
// https://github.com/vueuse/vueuse/issues/2875
|
||||
nextTick(()=> {
|
||||
if(learnPathDiagram.value){
|
||||
const scrollEvent = new Event('scroll');
|
||||
learnPathDiagram.value.dispatchEvent(scrollEvent);
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue