🐛 fix(vscode): 代码阅读预览跳到定义后页面还在长高(注释里的 mermaid 画成图、中文名到了)不再把视口带跑:页面滚动统一交给滚动所有者,跟住跳到的目标、用户自己滚了改钉视口顶部那块,关掉浏览器自带的滚动锚定
This commit is contained in:
1 parent
2fa6319dd4
commit
3c5f5f5f35
24 files changed
+1016
-149
No files matched your search
@@ -54,6 +54,11 @@ export function insetAbove(depth: number, lineHeight: number, limit: number): nu
|
||||
return Math.min(depth, limit) * lineHeight
|
||||
}
|
||||
|
||||
/** 眼下钉着的几行占多高([StickyLines](vscode/webview-ui/src/codeReader/StickyLines.tsx#StickyLines) 画的 `.cr-sticky`),没钉时是 0。 */
|
||||
export function stickyHeight(): number {
|
||||
return document.querySelector<HTMLElement>('.cr-sticky')?.offsetHeight ?? 0
|
||||
}
|
||||
|
||||
/** 两次算出来钉的一样(同几张、左右位置一样、推得一样多):一样就不重画 */
|
||||
export function samePinned(a: PinnedLines, b: PinnedLines): boolean {
|
||||
return a.offset === b.offset && a.scopes.length === b.scopes.length && a.scopes.every((scope, index) => {
|
||||
|
||||
Reference in new issue
Block a user