/* The mouse component allows an entity to listen to mouse triggers. @usage re.e('mouse') .on('mousedown:middle', function(m){ //m.x - x position //m.y - y position //m.scrX - screen x position //m.scrY - screen y position }) */ re.c('mouse') .statics({ l:[], press:function(e){ var b, c; //find which key if(e.which == null){ //IE if(e.button < 2){ b = 'left'; } else if(e.button == 4){ b = 'middle'; } else { b = 'right'; } } else { if(e.which < 2){ b = 'left'; } else if(e.which == 2){ b = 'middle'; } else { b = 'right'; } } c = 'mouse:'+b; //register mouse action if(re.pressed.d){ re.pressed.d[c] = (e.type == 'mousedown'); } re.c('mouse').event(e, c); }, event:function(e, extra){ //calculate mouse coordinate var x = e.offsetX; var y = e.offsetY; var that = re.c('mouse'); /* if(re.preventDefault && re.preventDefault.d[key]){ e.preventDefault(); } */ var c, t, obj; for(var i=0; i