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

给诸位提个醒,关系文字的坐标的 #8

Closed
bearki opened this issue Apr 6, 2023 · 1 comment
Closed

给诸位提个醒,关系文字的坐标的 #8

bearki opened this issue Apr 6, 2023 · 1 comment

Comments

@bearki
Copy link

bearki commented Apr 6, 2023

正常情况下

  • 前端的坐标是以左上角来计算的,这毫无问题

和服务器储存的坐标信息对比,你会发现:

  • X轴的坐标信息是对的(Dx <= fontendX <= Dx+Width),这毫无问题
  • Y轴的坐标信息是错的,前端的Y轴坐标小于了后端的Y轴开始坐标,也就是(fontendY <= Dy <= Dy_Height),你肯定会很紧张,以为自己算错了

把心放肚子里

  • 这是因为文字的坐标是以文字的左下角为原点的,也就是说服务端储存的Dy值已经是加上了Height之后的值了
  • 前端不需要任何处理,后端会在比对的时候自动减去Height值再进行比对,也就是(Dy - Height)≈ fontendY
  • 所以放心大胆的把这个看起来错误的Y值传给服务器,它会自己处理的
@wenlng
Copy link
Owner

wenlng commented May 18, 2024

正常情况下

  • 前端的坐标是以左上角来计算的,这毫无问题

和服务器储存的坐标信息对比,你会发现:

  • X轴的坐标信息是对的(Dx <= fontendX <= Dx+Width),这毫无问题
  • Y轴的坐标信息是错的,前端的Y轴坐标小于了后端的Y轴开始坐标,也就是(fontendY <= Dy <= Dy_Height),你肯定会很紧张,以为自己算错了

把心放肚子里

  • 这是因为文字的坐标是以文字的左下角为原点的,也就是说服务端储存的Dy值已经是加上了Height之后的值了
  • 前端不需要任何处理,后端会在比对的时候自动减去Height值再进行比对,也就是(Dy - Height)≈ fontendY
  • 所以放心大胆的把这个看起来错误的Y值传给服务器,它会自己处理的

嘿,v2 版本即将更新,坐标会有所变化哟 _

@wenlng wenlng closed this as completed Jun 1, 2024
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

No branches or pull requests

3 participants
@wenlng @bearki and others