5133379e43e2044834afd04ae25ced80bfdac1b2 tdreszer Tue Aug 31 10:30:56 2010 -0700 Make rightClick work for all of image, not just map items diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 9de752e..d00de36 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -1312,6 +1312,20 @@ function findMapItem(e) { // Find mapItem for given event; returns item object or null if none found. + + // rightClick for non-map items can be resolved to their parent tr and then trackName. + if(e.target.tagName.toUpperCase() != "AREA") { + var tr = $( e.target ).parents('tr.imgOrd'); + if( $(tr).length == 1 ) { + a = /tr_(.*)/.exec($(tr).attr('id')); // voodoo + if(a && a[1]) { + var id = a[1]; + return makeMapItem(id); + } + } + } + + // FIXME: do we really need to worry about non-imageV2 ? var x,y; if(imageV2) { // It IS appropriate to use coordinates relative to the img WHEN we have a hit in the right-hand side, but NOT @@ -1337,25 +1351,6 @@ y = e.pageY - e.target.offsetTop; } - if(e.target.tagName.toUpperCase() == "P") { - // This occurs in the left buttons when IMAGEv2_DRAG_REORDER is true. - var a = /p_btn_(.*)/.exec(e.target.id); - if(a && a[1]) { - var id = a[1]; - return makeMapItem(id); - } else { - return null; - } - } else if(e.target.tagName.toUpperCase() == "IMG") { - // This occurs in the left buttons when IMAGEv2_DRAG_REORDER is false. - var a = /img_btn_(.*)/.exec(e.target.id); - if(a && a[1]) { - var id = a[1]; - return makeMapItem(id); - } - // else fall-through (under msie). - } - var retval = -1; // console.log(e.target.tagName + "; " + e.target.id); for(var i=0;i