Skip to content

fix(snapline): snapline cannot show when zoomed #2153

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HawtinZeng
Copy link

This PR have not passed the test, because of some unrelated errors.
image
And the jest systax error: jest-runner\build\index.js: Class private methods are not enabled

Copy link

changeset-bot bot commented May 15, 2025

⚠️ No Changeset found

Latest commit: 3fd36c0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ChangeSuger
Copy link
Collaborator

👍,感谢 PR,这边提两个修改建议:

  1. 建议修改变量命名:epsino (?) -> spsilon ( $\epsilon$ )
  2. 目前只修改了 getHorizontalSnapline 方法(水平对齐辅助线),getVerticalSnapline 方法(垂直对齐辅助线)建议也一并修改

@HawtinZeng
Copy link
Author

OK

@boyongjiong
Copy link
Collaborator

boyongjiong commented May 27, 2025

👍,感谢 PR,这边提两个修改建议:

  1. 建议修改变量命名:epsino (?) -> spsilon (
    ϵ
    )
  2. 目前只修改了 getHorizontalSnapline 方法(水平对齐辅助线),getVerticalSnapline 方法(垂直对齐辅助线)建议也一并修改

第二个建议没问题,第一个是不是命名没啥问题呀,只是初始化可以直接用 Number. EPSILON 赋值呢?
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON

@ChangeSuger
Copy link
Collaborator

👍,感谢 PR,这边提两个修改建议:

  1. 建议修改变量命名:epsino (?) -> spsilon (
    ϵ
    )
  2. 目前只修改了 getHorizontalSnapline 方法(水平对齐辅助线),getVerticalSnapline 方法(垂直对齐辅助线)建议也一并修改

第二个建议没问题,第一个是不是命名没啥问题呀,只是初始化可以直接用 Number. EPSILON 赋值呢? https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON

这个值的大小是会影响触发对齐辅助线的范围的,相当于控制灵敏度,原来是相等条件,过于严格,设置为 Number.EPSILON 的话几乎等价于相等,感觉不太行。

然后目前这个方案下,调大灵敏度虽然可以解决对齐辅助线难触发的问题,但是实际显示对齐辅助线的时候,节点并不是完全对齐的,这个目前没想到好的解决方案🤔,不过误差比较小,不是严格要求对齐的话问题应该不大。

@HawtinZeng
Copy link
Author

HawtinZeng commented May 27, 2025

👍,感谢 PR,这边提两个修改建议:

  1. 建议修改变量命名:epsino (?) -> spsilon (
    ϵ
    )
  2. 目前只修改了 getHorizontalSnapline 方法(水平对齐辅助线),getVerticalSnapline 方法(垂直对齐辅助线)建议也一并修改

第二个建议没问题,第一个是不是命名没啥问题呀,只是初始化可以直接用 Number. EPSILON 赋值呢? https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON

这个值的大小是会影响触发对齐辅助线的范围的,相当于控制灵敏度,原来是相等条件,过于严格,设置为 Number.EPSILON 的话几乎等价于相等,感觉不太行。

然后目前这个方案下,调大灵敏度虽然可以解决对齐辅助线难触发的问题,但是实际显示对齐辅助线的时候,节点并不是完全对齐的,这个目前没想到好的解决方案🤔,不过误差比较小,不是严格要求对齐的话问题应该不大。

可以加对齐吸附,当拖动的对象与某个对象快要对齐的时候,将鼠标和这个拖动的对象的 X/Y 坐标设定为 这个对象的 X/Y坐标。这样肯定是对齐的, 很多 CAD 软件都是这样做的,而且也解决了"对齐了,但是松开鼠标的时候手抖了一下,又没对齐。"的问题。另外 epsilon 可以放在配置里面。

@HawtinZeng
Copy link
Author

最终还是决定不做 对齐吸附 的功能,原因是会改很多现有的逻辑,花很多精力,这个功能也没有那么重要。

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.

3 participants