是否可以设置捕捉设置?

发布于 2025-01-12 20:55:13 字数 559 浏览 0 评论 0原文

我正在使用 Autodesk Forge 查看器 v7 和 Edit2D 工具。这个问题具体是关于捕捉功能的。它目前正在工作,但有点过于热心......它似乎具有所有可能的捕捉(端点、沿线、交叉点、中心等)。它似乎也捕捉到我隐藏的图层。

有没有办法设置打开和关闭的快照?还有没有办法限制它捕捉到的图层?我一直在寻找一种可能的方法,它可以告诉我它试图捕捉的对象以及捕捉的类型,让我确定这是否是一个可行的捕捉点并返回 true/false 或类似的东西,但我不能找一个。有办法做到这一点吗?

编辑 我确实找到了 setSnapFilter 但它似乎没有做任何事情。我的代码中有这样的实现:

// @ts-ignore
e.defaultContext.snapper.sheetSnapper.setSnapFilter((e) => {
  console.log(e);
  return false;
});

但是,我从来没有发生过控制台日志。我已经在片状快照器和层快照器上尝试过此操作,并且尝试返回 true 和 false,但它们都没有被调用或对捕捉产生任何影响。

I'm using the Autodesk Forge viewer v7 using the Edit2D tool. This question is specifically about the snapping functionality. It is currently working but a bit overzealous... It seems to have all of the possible snaps on (endpoint, along line, intersections, centers, etc.). It also seems to snap to layers that I have hidden.

Is there a way to set the snaps that are on and off? Also is there a way to limit the layers that it snaps to? I was looking for possibly a method that will tell me the object(s) it's trying to snap to and the type of snap and let me determine if that's a viable snap point and return true/false or something like that but I couldn't find one. Is there a way to do this?

EDIT
I did find setSnapFilter but it doesn't seem to do anything. I have this implementation in my code:

// @ts-ignore
e.defaultContext.snapper.sheetSnapper.setSnapFilter((e) => {
  console.log(e);
  return false;
});

However, I never get a console log happening. I have tried this on both the sheet snapper and the layer snapper and I've tried returning both true and false and none of them are ever called or make any difference to the snapping.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最舍不得你 2025-01-19 20:55:13

好捕获! context.snapper.sheetSnapper 对象确实有一个可以重写的 setSnapFilter 方法。不幸的是,此过滤器仅在 Snapper#onMouseMove 方法中调用,而 Edit2D 扩展绕过此方法。这就是为什么重写该方法没有效果。让我将此信息传递给工程团队以供考虑。

Good catch! The context.snapper.sheetSnapper object does have a setSnapFilter method you can override. Unfortunately, this filter is only invoked in the Snapper#onMouseMove method, and the Edit2D extension bypasses this method. That's why overriding the method has no effect. Let me pass this info to the engineering team for consideration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文