ffea7ccf62ba088c64b5f5c3a8e3d56865e4b297 chmalee Fri Dec 8 09:33:52 2023 -0800 More tooltip fixups, hide/show the tooltip when leaving/re-entering the window, hide them upon opening a dropdown, fix hiding/showing them on right clicks and when entering the search bar, refs #32697 diff --git src/hg/js/jquery.contextmenu.js src/hg/js/jquery.contextmenu.js index 5b1910e..ce4aee9 100644 --- src/hg/js/jquery.contextmenu.js +++ src/hg/js/jquery.contextmenu.js @@ -189,30 +189,40 @@ width:(cmenu.menu.width()+cmenu.shadowWidthAdjust)+"px", height:(cmenu.menu.height()+cmenu.shadowHeightAdjust)+"px", top:(y+cmenu.shadowOffsetY)+"px", left:(x+cmenu.shadowOffsetX)+"px" }).addClass(cmenu.shadowClass)[cmenu.showTransition](cmenu.showSpeed); } }, // A hook to call before the menu is shown, in case special processing needs to be done. // Return false to cancel the default show operation beforeShow: function() { return true; }, // Show the context menu show: function(t,e) { var cmenu=this, x=e.pageX, y=e.pageY; + + // prevent tooltips from showing up while contextmenu is open + if (typeof showMouseovers !== 'undefined' && showMouseovers) { + console.log("right click open, disabling mouseovers"); + clearTimeout(mouseoverTimer); + mousemoveController.abort(); + hideMouseoverText(mouseoverContainer); + canShowNewMouseover = false; + } + cmenu.target = t; // Preserve the object that triggered this context menu so menu item click methods can see it if (cmenu.beforeShow(e)!==false) { // If the menu content is a function, call it to populate the menu each time it is displayed if (cmenu.menuFunction) { if (cmenu.menu) { $(cmenu.menu).remove(); } cmenu.menu = cmenu.createMenu(cmenu.menuFunction(cmenu,t),cmenu); cmenu.menu.css({display:'none'}); $(cmenu.appendTo).append(cmenu.menu); } var $c = cmenu.menu; x+=cmenu.offsetX; y+=cmenu.offsetY; var pos = cmenu.getPosition(x,y,cmenu,e); // Extracted to method for extensibility cmenu.showShadow(pos.x,pos.y,e); // Resize the iframe if needed if (cmenu.useIframe) { @@ -250,27 +260,32 @@ // use scrollTop to make sure menu doesn't disappear off the top (#7687). y = Math.max(y - h, $w.scrollTop()); } return {'x':x,'y':y}; }, // Hide the menu, of course hide: function() { var cmenu=this; if (cmenu.shown) { if (cmenu.iframe) { $(cmenu.iframe).hide(); } if (cmenu.menu) { cmenu.menu[cmenu.hideTransition](cmenu.hideSpeed,((cmenu.hideCallback)?function(){cmenu.hideCallback.call(cmenu);}:null)); } if (cmenu.shadow) { cmenu.shadowObj[cmenu.hideTransition](cmenu.hideSpeed); } } cmenu.shown = false; + // re-enable tooltips on contextmenu close + if (typeof showMouseovers !== 'undefined' && showMouseovers) { + console.log("contextmenu close, re-enabling tooltips"); + canShowNewMouseover = true; + } } }; // This actually adds the .contextMenu() function to the jQuery namespace $.fn.contextMenu = function(menu,options) { var cmenu = $.contextMenu.create(menu,options); this.each(function(){ $(this).bind('contextmenu',function(e){cmenu.show(this,e);return false;}); }); return cmenu; }; })(jQuery);