【发布时间】:2014-10-10 08:56:53
【问题描述】:
我想知道我们是否可以添加另一个动态事件,例如点击、触摸启动等。
例如:
$('canvas').drawArc({
layer:true,
strokeStyle: '#000',
strokeWidth: 5,
x: 100, y: 100,
radius: 50,
my_event : function(layer)
{
}
});
【问题讨论】:
我想知道我们是否可以添加另一个动态事件,例如点击、触摸启动等。
例如:
$('canvas').drawArc({
layer:true,
strokeStyle: '#000',
strokeWidth: 5,
x: 100, y: 100,
radius: 50,
my_event : function(layer)
{
}
});
【问题讨论】:
根据the documentation,click 和touchstart 事件已经在 jCanvas 中原生支持。您需要做的就是指定click 和touchstart(分别)作为回调的键名:
$('canvas').drawArc({
layer:true,
strokeStyle: '#000',
strokeWidth: 5,
x: 100, y: 100,
radius: 50,
click : function(layer)
{
},
touchstart : function(layer)
{
}
});
【讨论】: