التعليق: لا يمكن أن تتوافق الأشياء التي يتم رسمها على قماش مع أحداث الماوس ، ولكن استخدام JTOPO لإضافة الأحداث أمر بسيط للغاية. يوجد مثال أدناه ، يمكنك الرجوع إليه
عند استخدام HTML5 ، لا يمكن أن تتوافق الأشياء المرسومة على قماش مع أحداث الماوس ، ولكن إضافة الأحداث باستخدام JTOPO بسيطة للغاية ، مع التأثير التالي:مثال رمز:
var node = new jtopo.node ("hello") ؛
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 = 'relection clich plick' ؛
} آخر إذا (event.button == 1) {
node.text = 'refer the middle key' ؛
} آخر إذا (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") ؛
}) ؛