Amumu
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
8 deletions
-
components/anchor/Anchor.tsx
|
|
@ -174,14 +174,12 @@ const AnchorContent: React.FC<InternalAnchorProps> = (props) => { |
|
|
|
); |
|
|
|
if (linkNode && spanLinkNode.current) { |
|
|
|
const { style: inkStyle } = spanLinkNode.current; |
|
|
|
inkStyle.top = |
|
|
|
anchorDirection !== 'horizontal' |
|
|
|
? `${linkNode.offsetTop + linkNode.clientHeight / 2}px` |
|
|
|
: ''; |
|
|
|
inkStyle.height = anchorDirection !== 'horizontal' ? `${linkNode.clientHeight}px` : ''; |
|
|
|
inkStyle.left = anchorDirection === 'horizontal' ? `${linkNode.offsetLeft}px` : ''; |
|
|
|
inkStyle.width = anchorDirection === 'horizontal' ? `${linkNode.clientWidth}px` : ''; |
|
|
|
if (anchorDirection === 'horizontal') { |
|
|
|
const horizontalAnchor = anchorDirection === 'horizontal'; |
|
|
|
inkStyle.top = horizontalAnchor ? '' : `${linkNode.offsetTop + linkNode.clientHeight / 2}px`; |
|
|
|
inkStyle.height = horizontalAnchor ? '' : `${linkNode.clientHeight}px`; |
|
|
|
inkStyle.left = horizontalAnchor ? `${linkNode.offsetLeft}px` : ''; |
|
|
|
inkStyle.width = horizontalAnchor ? `${linkNode.clientWidth}px` : ''; |
|
|
|
if (horizontalAnchor) { |
|
|
|
scrollIntoView(linkNode, { |
|
|
|
scrollMode: 'if-needed', |
|
|
|
block: 'nearest', |
|
|
|