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

[Balloon]Tooltip 的水平对齐反直觉 #3197

Closed
guoyunhe opened this issue Jul 18, 2021 · 5 comments
Closed

[Balloon]Tooltip 的水平对齐反直觉 #3197

guoyunhe opened this issue Jul 18, 2021 · 5 comments
Assignees
Labels
2.x will be fixed in Design 2.0 🐞 Bug Something isn't working

Comments

@guoyunhe
Copy link
Contributor

Component

Balloon

Feature Description

设定左对齐的时候,气泡尖角仍然是居中的,气泡的左侧并没有和也没有和 trigger 元素的左侧对齐。效果十分诡异:

image

参考 Ant Design 的实现:

image

@youluna
Copy link
Member

youluna commented Jul 19, 2021

实现上图效果可以设置 <Balloon align="tl" alignEdge/ >

这个跟api的设计、使用思路有关,Fusion里是这么想的:

  • 弹出方向(align)分为t b l r tl bl等12个方向,这些方向都是基于触发器的中心位置
  • 如果不想要从触发器的中心位置开始弹出,那么可以开启alignEdge,开启后是贴着触发器边缘弹出

Uploading image.png…

@guoyunhe
Copy link
Contributor Author

我觉得好的 API 应该是能以最简单的形式实现常见的用途。比如 Ant Design 用一个属性就实现了左对齐,这对开发者来说,易于理解也易于使用。而 Fusion 要用两个属性,上手成本更高,而且容易产生上面提到的诡异效果。而这两个属性的命名也十分迷惑,中文“弹出方向”怎么也对不上“align”,要区分“align”和“alignEdge”也是十分困难的。

@youluna
Copy link
Member

youluna commented Jul 26, 2021

这个改动可以放到2.x 改动如下:

  • 增加API placement,去掉 align alignEdge两个API
  • 为了兼容新老版本,如果设置了placement,那么忽略align 和 alignEdge;如果没设置placement,那么读取 align alignEdge值
  • 为 align alignEdge 增加deprecated warning

@youluna youluna added the 2.x will be fixed in Design 2.0 label Jul 26, 2021
@guoyunhe
Copy link
Contributor Author

这个改动可以放到2.x 改动如下:

  • 增加API placement,去掉 align alignEdge两个API
  • 为了兼容新老版本,如果设置了placement,那么忽略align 和 alignEdge;如果没设置placement,那么读取 align alignEdge值
  • 为 align alignEdge 增加deprecated warning

这个只是 deprecated 并没有 breaking change,不需要等到 2.x 吧

@bindoon bindoon added the 🐞 Bug Something isn't working label Oct 27, 2021
@bindoon
Copy link
Member

bindoon commented Oct 27, 2021

1.25 版本支持,在设计新版本 overlay的时候已经发现这个问题了,订正过来了

关联 PR #3435

@bindoon bindoon closed this as completed Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x will be fixed in Design 2.0 🐞 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants