Hola,
Tengo el siguiente Script, que me sirve para tener el control del mouse, pero susede que cuando quiere verificar que se ha hecho click, este no me diferencia si fue el click derecho o el izquierdo, ya que cada uno tiene un funcion diferente:
Código Javascript
:
Ver originalMouse = {
click:false,
ring_click:false,
setup:function () {
this.canvas = Graphics
document.onmousemove = function (event) {
Mouse.update(event)
}
document.onmousedown = function () {
Mouse.click = true;
}
document.onmouseup = function () {
Mouse.click = false;
Mouse.ring_click = false;
}
document.oncontextmenu = function () {
Mouse.ring_click = true;
return false;
}
document.onmouseout = function () {
Mouse.click = false;
Mouse.ring_click = false;
}
},
update:function (e) {
this.realX = e.clientX
this.realY = e.clientY
this.x = e.clientX - this.canvas.data.offsetLeft
this.y = e.clientY - this.canvas.data.offsetTop
},
inside:function (rect, real) {
var x = real ? this.realX : this.x
var y = real ? this.realy : this.y
if (x >= rect.x && x< rect.x+rect.width &&
y >= rect.y && y< rect.y+rect.height) {
return true
}
}
}