简体   繁体   English

我如何在dynamicjs中创建一个下拉菜单

[英]How do I create a dropdown menu in kineticjs

I am trying to create a diagram editor using Kineticjs. 我正在尝试使用Kineticjs创建图编辑器。

Currently, I want to create a drop down menu with a scrollbar as in a select box. 目前,我想像选择框一样使用滚动条创建一个下拉菜单。 However, I am not sure of how to do that in Kineticjs. 但是,我不确定如何在Kineticjs中做到这一点。 Can someone give some advice as to the logic of the implementation of drop down menu in Kineticjs? 有人可以针对Kineticjs中下拉菜单的实现逻辑提供一些建议吗?

An example of what I want to create 我要创建的示例

Thank you very much in advance. 提前非常感谢您。

Warmest Regards, Dandy Ling 最诚挚的问候,丹迪·灵

You could just use the Layer and Group collections to logically create your Dropdown Box. 您可以只使用“ Layer和“ Group集合在逻辑上创建“下拉框”。

Adding the "mouseover/mouseout" events, you could just show/hide the groups within the Layer. 添加“ mouseover / mouseout”事件,您可以仅显示/隐藏图层中的组。

Then to make it really nice, you could use the Tween/Animation classes to animate the x/y position of each of the options. 然后,要使其真正好用,可以使用Tween / Animation类为每个选项的x / y位置设置动画。

Then you just need to hook-up the "click/touchdown" events to methods that call you core logic. 然后,您只需要将“ click / touchdown”事件关联到调用您的核心逻辑的方法即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM