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) {
|
||||
const scrollView = document.getElementById("scroll-view");
|
||||
const taskTop = taskElement.offsetTop;
|
||||
const scrollViewHeight = scrollView.clientHeight;
|
||||
const taskHeight = taskElement.offsetHeight;
|
||||
const targetScrollTop = taskTop - (scrollViewHeight / 2) + (taskHeight / 2);
|
||||
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}`);
|
||||
});
|
||||
// Align task to top of scroll view instead of center
|
||||
scrollView.scrollTop = taskTop;
|
||||
console.log("scrollTop set to taskTop:", taskTop);
|
||||
} else {
|
||||
console.log("Task element not found for id:", taskId);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user