Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixbug: 页面有zoom放大缩小时,自动定位位置不符合预期 #55 #69

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lin-123
Copy link

@lin-123 lin-123 commented Dec 22, 2022

#55

@lin-123
Copy link
Author

lin-123 commented Dec 23, 2022

当页面存在缩放的时候, 在计算 offset 相对位置时将缩放比例放进去, 使其变成真实偏移量。

if ('left' in offset) {
resultXY.x = originalXY.x + offset.left - originalOffset.left;
}
if ('top' in offset) {
resultXY.y = originalXY.y + offset.top - originalOffset.top;
resultXY.y = originalXY.y + offset.top - originalOffset.top ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resultXY.y = originalXY.y + offset.top - originalOffset.top ;
resultXY.y = originalXY.y + offset.top - originalOffset.top;

@@ -154,3 +155,6 @@ const div = (
);

ReactDOM.render(div, $id('__react-content'));

document.body.style.transform = 'scale(0.9)'
document.body.style.transformOrigin = 'top left'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单独开个例子演示这个?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除, 并增加了新的例子 scale.js

@afc163
Copy link
Contributor

afc163 commented Feb 22, 2023

@zombieJ 这个问题切到 @rc-component/trigger 后能解么?

@zombieJ
Copy link
Collaborator

zombieJ commented Feb 27, 2023

@zombieJ 这个问题切到 @rc-component/trigger 后能解么?

能,新的实现是直接按照最终画板计算的:https://ant.design/docs/blog/tooltip-align-cn#%E7%BC%A9%E6%94%BE%E6%AF%94

@wygkzqa
Copy link

wygkzqa commented May 29, 2023

不发版吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants