当孩子们互相碰撞时渲染面板中的其他元素

发布于 2024-12-12 01:22:20 字数 545 浏览 0 评论 0原文

我创建了一个自定义面板,它的渲染方式就像画布渲染它的子面板一样。我希望将两个相互碰撞的元素(即在某处相互接触)替换为另一个控件,该控件允许自定义渲染这些彼此靠近的元素,例如将它们放入上下文菜单中。

我有可以正确检测这些命中的代码,但是,我似乎无法用其他元素替换这些元素,因为面板始终在 InternalChildren 数组中绘制项目。

在他们到达小组之前我无法进行此命中测试。由于它们来自可以分组的视图,并且由于放大和缩小(这会影响子级的位置/大小),因此在面板测量发生之前不会知道哪些元素发生碰撞。

有没有办法让面板渲染除InternalChildren数组中的元素之外的其他元素?

编辑:图像

http://www.imagedump.nl/img827/2849/12unled.png< /a>

请注意,我不关心块 C 是否被另一个组件替换,因此如果用合并块替换它更容易(我认为会更容易),那么就这样做。

I have created a custom panel that renders like a canvas renders it's children. I would like that 2 elements that hit each other (ie. touch each other somewhere) get replaced by another control that allows custom rendering of these elements near each other and for example puts them in a context menu.

I have code that can correctly detect these hits, however, I cannot seem to replace the elements by other elements, as the panel is always drawing the items in InternalChildren array.

I cannot do this hit testing before they get to the panel. As they come from a view that can be grouped and due to zooming in and out (which effects the positions/sizes of the children), won't know which elements collide until measuring of the panel happens.

Is there any way to let the panel render other elements than those that are in the InternalChildren array?

EDIT: image

http://www.imagedump.nl/img827/2849/12unled.png

Note that I do not care if block C get's replaced by another component or not, so if replacing it with a merged block is easier (which I think it will be), do so.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文