Right click on viewport/canvas

When a user right clicks an object in my game I would like to be able to have a menu come up. Is it possible to override the right click event only for the canvas and still allow normal right click functions outside of the canvas?


document.onmousedown = handleMouseDown;

function handleMouseDown(event){

if ( mouse_pos ) inside gl canvas
return false;
return true;

true = menu comes up
false = no menu

Thanks zed. Very helpful!