修复左侧list和右侧甘特视图滚动偏差,行无法对齐问题
This commit is contained in:
@@ -313,14 +313,12 @@ const handleTaskListScroll = (event: Event) => {
|
|||||||
detail: { scrollTop },
|
detail: { scrollTop },
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}// 处理Timeline垂直滚动同步
|
||||||
|
|
||||||
// 处理Timeline垂直滚动同步
|
|
||||||
const handleTimelineVerticalScroll = (event: CustomEvent) => {
|
const handleTimelineVerticalScroll = (event: CustomEvent) => {
|
||||||
const { scrollTop } = event.detail
|
const { scrollTop } = event.detail
|
||||||
const taskListBodyElement = document.querySelector('.task-list-body') as HTMLElement
|
const taskListBodyElement = document.querySelector('.task-list-body') as HTMLElement
|
||||||
if (taskListBodyElement && taskListBodyElement.scrollTop !== scrollTop) {
|
if (taskListBodyElement && Math.abs(taskListBodyElement.scrollTop - scrollTop) > 1) {
|
||||||
// 避免循环触发,只在scrollTop不同时才设置
|
// 使用更精确的比较,避免1px以内的细微差异导致的循环触发
|
||||||
taskListBodyElement.scrollTop = scrollTop
|
taskListBodyElement.scrollTop = scrollTop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -518,7 +518,8 @@ onUnmounted(() => {
|
|||||||
.task-row {
|
.task-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
border-bottom: 1px solid var(--gantt-border-light);
|
border-bottom: 1px solid var(--gantt-border-light);
|
||||||
height: 50px;
|
height: 51px; /* 修改为51px,与Timeline中的task-row高度保持一致,包含border-bottom 1px */
|
||||||
|
box-sizing: border-box; /* 确保border包含在高度计算中 */
|
||||||
background: var(--gantt-bg-primary);
|
background: var(--gantt-bg-primary);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: var(--gantt-text-secondary);
|
color: var(--gantt-text-secondary);
|
||||||
|
|||||||
@@ -1543,8 +1543,8 @@ onMounted(() => {
|
|||||||
const handleTaskListVerticalScroll = (event: CustomEvent) => {
|
const handleTaskListVerticalScroll = (event: CustomEvent) => {
|
||||||
const { scrollTop } = event.detail
|
const { scrollTop } = event.detail
|
||||||
const timelineBody = document.querySelector('.timeline-body') as HTMLElement
|
const timelineBody = document.querySelector('.timeline-body') as HTMLElement
|
||||||
if (timelineBody && timelineBody.scrollTop !== scrollTop) {
|
if (timelineBody && Math.abs(timelineBody.scrollTop - scrollTop) > 1) {
|
||||||
// 避免循环触发,只在scrollTop不同时才设置
|
// 使用更精确的比较,避免1px以内的细微差异导致的循环触发
|
||||||
timelineBody.scrollTop = scrollTop
|
timelineBody.scrollTop = scrollTop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user