diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 760ba8aba2..004781a571 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -231,25 +231,25 @@ const Tooltip = React.forwardRef((props, ref) => { placements[key].points![0] === align.points?.[0] && placements[key].points![1] === align.points?.[1], ); - if (!placement) { - return; - } - // 根据当前坐标设置动画点 - const rect = domNode.getBoundingClientRect(); - const transformOrigin = { top: '50%', left: '50%' }; + if (placement) { + // 根据当前坐标设置动画点 + const rect = domNode.getBoundingClientRect(); - if (/top|Bottom/.test(placement)) { - transformOrigin.top = `${rect.height - align.offset![1]}px`; - } else if (/Top|bottom/.test(placement)) { - transformOrigin.top = `${-align.offset![1]}px`; + const transformOrigin = { top: '50%', left: '50%' }; + + if (/top|Bottom/.test(placement)) { + transformOrigin.top = `${rect.height - align.offset![1]}px`; + } else if (/Top|bottom/.test(placement)) { + transformOrigin.top = `${-align.offset![1]}px`; + } + if (/left|Right/.test(placement)) { + transformOrigin.left = `${rect.width - align.offset![0]}px`; + } else if (/right|Left/.test(placement)) { + transformOrigin.left = `${-align.offset![0]}px`; + } + domNode.style.transformOrigin = `${transformOrigin.left} ${transformOrigin.top}`; } - if (/left|Right/.test(placement)) { - transformOrigin.left = `${rect.width - align.offset![0]}px`; - } else if (/right|Left/.test(placement)) { - transformOrigin.left = `${-align.offset![0]}px`; - } - domNode.style.transformOrigin = `${transformOrigin.left} ${transformOrigin.top}`; }; const getOverlay = () => { diff --git a/scripts/post-script.js b/scripts/post-script.js index 96461bfd23..4363a9e45a 100644 --- a/scripts/post-script.js +++ b/scripts/post-script.js @@ -26,6 +26,7 @@ const DEPRECIATED_VERSION = { '5.0.4': ['https://github.com/ant-design/ant-design/issues/39284'], '5.0.6': ['https://github.com/ant-design/ant-design/issues/39807'], '5.1.0': ['https://github.com/react-component/drawer/pull/370'], + '5.1.2': ['https://github.com/ant-design/ant-design/issues/39949'], }; function matchDeprecated(version) {