700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 使用jTopo给Html5 Canva中绘制的元素添加鼠标事件_html5教程技巧

使用jTopo给Html5 Canva中绘制的元素添加鼠标事件_html5教程技巧

时间:2018-09-23 15:31:57

相关推荐

使用jTopo给Html5 Canva中绘制的元素添加鼠标事件_html5教程技巧

代码如下:

var node = new JTopo.Node("Hello");

node.setLocation(409, 269);

node.mousedown(function(event){

if(event.button == 2){

node.text = '按下右键';

}else if(event.button == 1){

node.text = '按下中键';

}else if(event.button == 0){

node.text = '按下左键';

}

});

node.mouseup(function(event){

if(event.button == 2){

node.text = '松开右键';

}else if(event.button == 1){

node.text = '松开中键';

}else if(event.button == 0){

node.text = '松开左键';

}

});

node.click(function(event){

console.log("单击");

});

node.dbclick(function(event){

console.log("双击");

});

node.mousedrag(function(event){

console.log("拖拽");

});

node.mouseover(function(event){

console.log("mouseover");

});

node.mousemove(function(event){

console.log("mousemove");

});

node.mouseout(function(event){

console.log("mouseout");

});

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。