feat(short-drama-agent-front): 完善分镜审核与制作准备流程
This commit is contained in:
1 parent
c4b43b9725
commit
1da56e0d46
72 files changed
+2801
-528
No files matched your search
@@ -59,16 +59,20 @@ function syncActive() {
|
||||
active.value = current
|
||||
}
|
||||
|
||||
/** 内容或尺寸变化时同步实际顶部留白与章节位置;隐藏标签不覆盖已有阅读位置。 */
|
||||
/** 内容或尺寸变化时同步章节位置并对齐滚动像素,避免首集与跳转后的标题出现小数偏差。 */
|
||||
function measure() {
|
||||
if (!viewport?.clientHeight || !readerContent.value) return
|
||||
viewportHeight.value = viewport.clientHeight
|
||||
readingInset = parseFloat(getComputedStyle(readerContent.value).paddingTop) || 32
|
||||
const origin = viewport.getBoundingClientRect().top - viewport.scrollTop
|
||||
positions = [...readerContent.value.querySelectorAll<HTMLElement>('[data-episode]')].map(item => ({
|
||||
episode: Number(item.dataset.episode),
|
||||
top: item.getBoundingClientRect().top - origin
|
||||
}))
|
||||
positions = [...readerContent.value.querySelectorAll<HTMLElement>('[data-episode]')].map(item => {
|
||||
// 先扣除上次微调,再按滚动距离取整,反复测量时不会累积偏移。
|
||||
const previousOffset = parseFloat(item.style.getPropertyValue('--reader-chapter-offset')) || 0
|
||||
const top = item.getBoundingClientRect().top - origin - previousOffset
|
||||
const alignedTop = readingInset + Math.round(top - readingInset)
|
||||
item.style.setProperty('--reader-chapter-offset', `${alignedTop - top}px`)
|
||||
return { episode: Number(item.dataset.episode), top: alignedTop }
|
||||
})
|
||||
syncActive()
|
||||
}
|
||||
|
||||
@@ -384,8 +388,13 @@ onBeforeUnmount(() => observer?.disconnect())
|
||||
/* 正文紧邻目录左对齐,保留阅读行宽,不在宽屏内容区居中。 */
|
||||
max-width: 900px;
|
||||
}
|
||||
.reader-chapter {
|
||||
/* 浏览器会取整滚动距离;整章最多微调半像素,让标题、摘要与正文使用相同起点。 */
|
||||
translate: 0 var(--reader-chapter-offset, 0px);
|
||||
}
|
||||
.reader-chapter + .reader-chapter {
|
||||
@apply mt-12 pt-9;
|
||||
/* 章节间隔全部放在外部,目录定位到章节顶部时不再额外带入 36px 内边距。 */
|
||||
@apply mt-21;
|
||||
}
|
||||
.reader-chapter:last-child {
|
||||
/* 末集较短时仍可定位到阅读线,不必把倒数第二集误认为当前集。 */
|
||||
|
||||
Reference in new issue
Block a user