ความคิดเห็น: สิ่งที่วาดบนผืนผ้าใบไม่สามารถสอดคล้องกับเหตุการณ์เมาส์ แต่การใช้ JTOPO เพื่อเพิ่มเหตุการณ์นั้นง่ายมาก มีตัวอย่างด้านล่างคุณสามารถอ้างอิงได้
เมื่อใช้ HTML5 สิ่งที่วาดบนผืนผ้าใบไม่สามารถสอดคล้องกับเหตุการณ์ของเมาส์ แต่การเพิ่มเหตุการณ์โดยใช้ JTOPO นั้นง่ายมากโดยมีเอฟเฟกต์ต่อไปนี้:ตัวอย่างรหัส:
var node = new jtopo.node ("สวัสดี");
Node.SetLocation (409, 269);
node.mousedown (ฟังก์ชั่น (เหตุการณ์) {
if (event.button == 2) {
node.text = 'คลิกขวา';
} อื่นถ้า (Event.button == 1) {
node.text = 'กดปุ่มกลาง';
} อื่นถ้า (Event.button == 0) {
node.text = 'กดปุ่มซ้าย';
-
-
node.mouseup (ฟังก์ชั่น (เหตุการณ์) {
if (event.button == 2) {
node.text = 'รีลีสคลิกขวา';
} อื่นถ้า (Event.button == 1) {
node.text = 'ปล่อยคีย์กลาง';
} อื่นถ้า (Event.button == 0) {
node.text = 'ปล่อยปุ่มซ้าย';
-
-
node.click (ฟังก์ชั่น (เหตุการณ์) {
console.log ("คลิก");
-
node.dbclick (ฟังก์ชั่น (เหตุการณ์) {
console.log ("ดับเบิลคลิก");
-
node.mousedrag (ฟังก์ชั่น (เหตุการณ์) {
console.log ("ลาก");
-
node.mouseover (ฟังก์ชั่น (เหตุการณ์) {
console.log ("Mouseover");
-
node.mousemove (ฟังก์ชั่น (เหตุการณ์) {
console.log ("Mousemove");
-
node.mouseout (ฟังก์ชั่น (เหตุการณ์) {
console.log ("mouseout");
-