在 Flex 4 中,mouseOut 事件在调整大小后根据旧组件的大小触发?如何避免这种情况?

发布于 2024-10-26 04:18:53 字数 339 浏览 0 评论 0原文

我有一个名为 X 的组件。当我将鼠标放在它上面时,我试图从它中弹出一个菜单。

我有一个 mouseOver 处理程序,它将组件的状态更改为另一个状态,该状态在下部显示一个额外的子组件(菜单)。这当然会让X组件增长。

我还有 mouseOut 事件处理程序,它通过将组件 X 返回到其原始状态来使菜单消失。

当我将鼠标移到组件上时,菜单将按预期显示。但是,当我将鼠标向下移动到现在可见的菜单时,只要我触摸它,它就会消失。这样就不可能到达菜单。

我猜想一旦我移出旧边界,就会触发 mouseOut 事件。是这样吗?我怎样才能避免它?新的边界现在应该考虑菜单中的额外子项。

提前致谢, 努诺

I have a component called X. I'm trying to make a menu come down from it when I put my mouse over it.

I have a mouseOver handler which changes the component's state to another state which shows an extra child component (the menu) on the lower part. This of course makes the X component grow.

I also have mouseOut event handler which makes the menu disappear by returning component X to its original state.

When I move the mouse over the component the menu appears as expected. But when I move the mouse down to the menu that is now visible, as soon as I touch it, it disappears. This way it's impossible to reach the menu.

I guess the mouseOut event is triggered as soon as I move out of the old boundaries. Is this so? And how can I avoid it? The new boundaries should now consider the extra child with the menu.

Thanks in advance,
Nuno

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

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

发布评论

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

评论(1

未央 2024-11-02 04:18:53

当您将鼠标移到子元素上时,您将鼠标移出组件“X”。
如果没有看到代码,我真的无法帮助你。但是您可能想尝试一些事情。

  • 制作一个测试命中区域的函数
    鼠标和组件的并且仅
    如果事件通过,则调度该事件
    仅当鼠标不在您的上方时才将其移出
    成分。您的组件不应仅因为鼠标移出组件而调度鼠标移出事件
  • 根据需要更改侦听器
  • 事件传播

    但实际上,如果没有代码,我无法提供更多帮助。

When you move over the child element you are mousing out of compo0nent "X".
Without seeing code I can't really help you. However you might want to try a few things.

  • Make a function that tests hit area
    of the mouse and component and only
    dispatch the event if it passes a
    mouse out only if it isn't over your
    component. Your component shouldn't dispatch a mouse out event just because the mouse moved out of the component
  • Change your listeners as needed
  • Event propagation

    But really there is no way I can help more without code.

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