Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/12/2011, 01:45
Avatar de ClubIce
ClubIce
 
Fecha de Ingreso: diciembre-2008
Mensajes: 216
Antigüedad: 15 años, 4 meses
Puntos: 2
Pregunta Diferenciar Click Derecho con Izquierdo

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 original
  1. Mouse = {
  2.     click:false,
  3.     ring_click:false,
  4.     setup:function () {
  5.         this.canvas = Graphics
  6.         document.onmousemove = function (event) {
  7.             Mouse.update(event)
  8.         }
  9.         document.onmousedown = function () {
  10.             Mouse.click = true;
  11.         }
  12.         document.onmouseup = function () {
  13.             Mouse.click = false;
  14.             Mouse.ring_click = false;
  15.         }
  16.         document.oncontextmenu = function () {
  17.             Mouse.ring_click = true;
  18.             return false;
  19.         }
  20.         document.onmouseout = function () {
  21.             Mouse.click = false;
  22.             Mouse.ring_click = false;
  23.         }
  24.     },
  25.     update:function (e) {
  26.         this.realX = e.clientX
  27.         this.realY = e.clientY
  28.         this.x = e.clientX - this.canvas.data.offsetLeft
  29.         this.y = e.clientY - this.canvas.data.offsetTop
  30.  
  31.     },
  32.     inside:function (rect, real) {
  33.         var x = real ? this.realX : this.x
  34.         var y = real ? this.realy : this.y
  35.         if (x >= rect.x && x< rect.x+rect.width &&
  36.                 y >= rect.y && y< rect.y+rect.height) {
  37.             return true
  38.         }
  39.     }
  40. }