When using Html5, the items drawn on the Canvas cannot respond to mouse events, but it is very easy to add events using jTopo. The effect is as follows:
Http://www.jtopo.com/demo/helloworld.html
Sample Code:
Var node = new JTopo. node ("Hello"); node. setLocation (409,269); node. mousedown (function (event) {if (event. button = 2) {node. text = 'right-click ';} else if (event. button = 1) {node. text = 'Press the key';} else if (event. button = 0) {node. text = 'left click' ;}}); node. mouseup (function (event) {if (event. button = 2) {node. text = 'open right-click ';} else if (event. button = 1) {node. text = 'loose key';} else if (event. button = 0) {node. text = 'login' ;}}); node. click (function (event) {console. log ("click") ;}); node. dbclick (function (event) {console. log ("double-click") ;}); node. mousedrag (function (event) {console. log ("drag") ;}); node. mouseover (function (event) {console. log ("mouseover") ;}); node. mousemove (function (event) {console. log ("mousemove") ;}); node. mouseout (function (event) {console. log ("mouseout ");});