简体   繁体   English

右键单击不显示图像

[英]right click not diplayed on an image

I have a basic issue with an image. 我有一个基本的图像问题。

Indeed, I can't make display a right click menu on the image (in order to see it in full display) : 实际上,我无法在图像上显示右键菜单(以便完整显示该菜单):

I have just put a : 我刚放了:

<img class="center" width="700" height ="381" src="./Image_Init_Scene.png"/>

Maybe the issue comes from other things in my HTML page (like jquery etc ..) 也许问题来自我HTML页面中的其他内容(例如jquery等..)

Any help is welcome, 欢迎任何帮助,

Thanks 谢谢

It looks like the normal behavior of the contextmenu event is prevented somewhere in your code... 看起来contextmenu事件的正常行为在您的代码中某处被阻止了...

So you can find where it is prevented to remove this "protection"... 因此,您可以找到阻止删除此“保护”的地方...
Or you can create you own custom context menu. 或者,您可以创建自己的自定义上下文菜单。

The event is still triggered, so you can use it. 该事件仍被触发,因此您可以使用它。

$(".body_content img.center").on("contextmenu",function(){
    console.log("Context menu!");
    // Do what ever you want!
});

Context Menu is being interrupted by an event handler somewhere in your code. 上下文菜单被代码中某个位置的事件处理程序中断。 While searching for event.preventDefault() works, this may be the long way out. 在搜索event.preventDefault() ,这可能是很长的路要走。 Also this may not work if programmer is using return false 如果程序员使用return false这也可能不起作用

The easy way is to set a break point in the Debugger. 最简单的方法是在调试器中设置一个断点。 Chrome offers a context menu breakpoint among others under Event Listener Breakpoints. Chrome在“事件监听器断点”下提供了上下文菜单断点。 Pausing the execution on modification will tell you, where the context menu is being manipulated. 暂停修改后的执行将告诉您上下文菜单的操作位置。

For example, in your code, context menu is being used in two places postload.js and orbitcontrols.js. 例如,在您的代码中,上下文菜单在两个位置postload.js和orbitcontrols.js中使用。 Orbit controls is preventing the context menu action with 轨道控件正在阻止上下文菜单操作

 function onContextMenu( event ) { event.preventDefault(); } scope.domElement.addEventListener( 'contextmenu', onContextMenu, false ); 

Removing this will restore context menu to original state. 删除此选项将使上下文菜单恢复到原始状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM