优化:周视图月开始分隔线实现使用canvas替代dom

This commit is contained in:
qiuchengw
2025-11-12 08:24:55 +08:00
parent cf094c8e2c
commit e8d3bb77c6
2 changed files with 41 additions and 29 deletions
+2 -27
View File
@@ -3283,6 +3283,8 @@ const handleAddSuccessor = (task: Task) => {
:highlighted-task-id="highlightedTaskId"
:highlighted-task-ids="highlightedTaskIds"
:hovered-task-id="hoveredTaskId"
:vertical-lines="monthFirstVerticalLines"
:show-vertical-lines="currentTimeScale === TimelineScale.WEEK"
/>
<!-- 年度视图今日标记线 -->
@@ -3295,17 +3297,6 @@ const handleAddSuccessor = (task: Task) => {
}"
></div>
<!-- 月份1号竖直线(周视图) - 优化:使用预计算的位置数组 -->
<div
v-for="(line, index) in monthFirstVerticalLines"
:key="`vline-${index}`"
class="month-first-vertical-line"
:style="{
left: `${line.left}px`,
height: `${contentHeight}px`,
}"
></div>
<!-- 背景列 -->
<div class="day-columns" :style="{ height: `${contentHeight}px` }">
<!-- 小时视图背景列 -->
@@ -3874,22 +3865,6 @@ const handleAddSuccessor = (task: Task) => {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
/* 月份1号竖直线样式 */
.month-first-vertical-line {
position: absolute;
top: 0;
width: 1px;
background-color: var(--gantt-primary, #409eff);
opacity: 0.6;
z-index: 5;
pointer-events: none;
}
/* 暗色主题下的竖直线 */
:global(html[data-theme='dark']) .month-first-vertical-line {
background-color: var(--gantt-primary-light, #66b1ff);
}
/* 周视图背景列样式 */
.month-week-columns {
display: flex;