使用jTopo给Html5 Canva中的元素添加鼠标事件
来源:互联网 发布:mac ssh修改端口 编辑:程序博客网 时间:2024/05/16 20:40
使用Html5的时候,在Canvas上绘制的东西是不能响应鼠标事件的,但是使用jTopo添加事件非常简单,效果如下:
http://www.jtopo.com/demo/helloworld.html
代码示例:
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");});
0 0
- 使用jTopo给Html5 Canva中的元素添加鼠标事件
- 使用jTopo给Html5 Canva中绘制的元素添加鼠标事件_html5教程技巧
- 给ajax加载的页面元素添加鼠标事件
- 使用js给元素添加事件
- 给层或者html中的某个元素添加删除事件
- JS给元素添加事件
- 给DBGrid添加鼠标滚动事件
- 给DBGrid添加鼠标滚动事件
- 给DBGrid添加鼠标滚动事件
- 给DBGrid添加鼠标滚动事件
- html5 svg 中元素点击事件添加
- 【HTML5】Canvas 内部元素添加事件处理
- Html5 canva画图
- js 给dom元素添加事件
- jQuery 给动态添加元素绑定事件
- 给动态增加的元素添加事件
- 给动态添加的元素绑定事件
- 如何给动态元素添加事件
- HDU 4282 A very hard mathematic problem(解方程 天津网络赛)
- c语言:五大基本排序算法
- 笔记本主板上的三极管与晶振的检查方法
- 整理了一些ASP初学者常用的代码
- 使用putty连接到虚拟机centos被拒绝解决方法
- 使用jTopo给Html5 Canva中的元素添加鼠标事件
- 使.NET应用程序开发标准化(转)
- hadoop学习笔记4:java实现hdfs -ls/-lsr
- 比较通用的,就是用IE的WebBrowser
- 扩展欧几里得算法
- ASP.NET实现用户在线检测的类源码
- Oracle SCN headroom、ORA-19706 和_external_scn_rejection_threshold_hours
- JavaScript高级程序设计(第2版) 学习笔记:(三)js原型的四种形态
- iOS开发-clang: error: unknown argument: '-websockets'解决办法