悬停、菜单和按钮
我想设置一个矩形/槽,当悬停在其上时,会创建一个悬停在矩形/槽侧面的小窗口(有点重叠)。
我还想在小菜单中添加一些按钮。 我希望小菜单比原始的矩形/插槽更长(宽度方向),以便容纳许多按钮,这意味着我不能使用 slot.hover,因为如果我从直接到按钮上的按钮...有什么帮助吗?
I want to setup a rect/slot, that when hovered over, creates a little window hovering off the side of the rect/slot (a little overlapping).
I'd also like to fit some buttons in the little menu. I'd like the little menu to be longer (width-wise) than the original rect/slot, in order to fit many buttons, which means I can't use slot.hover, because the menu goes away if I move from the rect to the button thats off the rect... Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个示例,应该向您展示完成此操作所需的逻辑。 如果你有一堆这样的菜单,它显然会失控:
这是对上述解决方案的即兴发挥,它扩展了 Shoes::Stack 和 Shoes::App 类以添加
hover?
方法到堆栈(我认为他们应该默认支持)。 对于您的情况,我会考虑创建一个自定义小部件,但这显示了您可能能够使用的结构类型。Here is an example that should show you the logic you need in order to accomplish this. It would obviously get out of hand if you had a bunch of these menus:
Here is a riff on the above solution which extends the Shoes::Stack and Shoes::App classes to add a
hover?
method to stacks (which I think they ought to support by default). In your case, I'd consider creating a custom Widget instead, but this shows the sort of structure you might be able to use.听起来您需要使用一些额外的东西来保持该矩形在按钮上以及在插槽上时保持打开和可见。
这样就可以在任何事情发生时都将菜单保留在那里。
Sounds like you need to use some extra stuff to keep that rect open and visible while on a button as well as while over the slot.
That should keep the menu there while over anything.