fix: align task to top instead of center in scroll view
This commit is contained in:
parent
025195be27
commit
ca7bd7e24e
@ -164,20 +164,9 @@ function scrollToTask(taskId) {
|
|||||||
if (taskElement) {
|
if (taskElement) {
|
||||||
const scrollView = document.getElementById("scroll-view");
|
const scrollView = document.getElementById("scroll-view");
|
||||||
const taskTop = taskElement.offsetTop;
|
const taskTop = taskElement.offsetTop;
|
||||||
const scrollViewHeight = scrollView.clientHeight;
|
// Align task to top of scroll view instead of center
|
||||||
const taskHeight = taskElement.offsetHeight;
|
scrollView.scrollTop = taskTop;
|
||||||
const targetScrollTop = taskTop - (scrollViewHeight / 2) + (taskHeight / 2);
|
console.log("scrollTop set to taskTop:", taskTop);
|
||||||
console.log("scrollViewHeight:", scrollViewHeight, "taskHeight:", taskHeight);
|
|
||||||
console.log("taskTop:", taskTop, "targetScrollTop:", targetScrollTop);
|
|
||||||
scrollView.scrollTop = targetScrollTop;
|
|
||||||
console.log("scrollTop set to:", scrollView.scrollTop);
|
|
||||||
|
|
||||||
// Check all task positions
|
|
||||||
const allTasks = scrollView.querySelectorAll('.task-item');
|
|
||||||
console.log("All task positions:");
|
|
||||||
allTasks.forEach((t, i) => {
|
|
||||||
console.log(` Task ${t.dataset.taskId}: offsetTop=${t.offsetTop}, visible=${t.offsetTop >= targetScrollTop && t.offsetTop < targetScrollTop + scrollViewHeight}`);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
console.log("Task element not found for id:", taskId);
|
console.log("Task element not found for id:", taskId);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user