0
我在asp.net mvc程序中使用了syncfusion的ej图,我想知道是否有任何选项让我通过创建一个新节点输入或任何其他的关键?我的意思是我可以使用任何键盘键来创建和编辑图表或任何我自己实现此功能的键盘事件处理程序?在aspmvc应用程序中使用键盘按键在syncfusion图
我在asp.net mvc程序中使用了syncfusion的ej图,我想知道是否有任何选项让我通过创建一个新节点输入或任何其他的关键?我的意思是我可以使用任何键盘键来创建和编辑图表或任何我自己实现此功能的键盘事件处理程序?在aspmvc应用程序中使用键盘按键在syncfusion图
要达到您的要求,请使用“命令管理器”,该命令管理器提供支持,以根据所需的键手势组合映射/绑定命令执行。当我们按下Shift + C键时,请参考下面的代码片段,它代表节点的创建。
代码片段:
DiagramProperties model = new DiagramProperties();
Dictionary<string, object> Commands = new Dictionary<string, object>()
{
{
//command name
"createNode",
//command definition
new Command()
{
//Name of the method/command handler that is defined in scripts
Execute = "execute",
//Gesture to define when the command is to be executed
Gesture = new Gesture()
{
//Combination of keys and modifier keys
Key = Keys.C, KeyModifiers = KeyModifiers.Shift
}
}
}
};
model.CommandManager.Commands = Commands;
<script type="text/javascript">
function execute(args) {
//add the node
$("#Diagram1").ejDiagram("instance").add({ name: "rect", width: 100, height: 100, offsetX: 200, offsetY: 200 })
}
</script>