-1

当我右键单击场景中的对象 3D 时,我不想添加上下文菜单

作为这个java脚本代码

$(function(){
$.contextMenu({
    selector: '.context-menu-one', 
    callback: function(key, options) {
        var m = "clicked: " + key;
        window.console && console.log(m) || alert(m); 
    },
    items: {
        "edit": {name: "Edit", icon: "edit"},
        "cut": {name: "Cut", icon: "cut"},
        "copy": {name: "Copy", icon: "copy"},
        "paste": {name: "Paste", icon: "paste"},
        "delete": {name: "Delete", icon: "delete"},
        "sep1": "---------",
        "quit": {name: "Quit", icon: "quit"}
    }
});

$('.context-menu-one').on('click', function(e){
    console.log('clicked', this);
})

});

<div class="context-menu-one box menu-1">
<strong>right click me</strong>

这段代码我用它来创建菜单,但找不到使它相对于场景中的 3D 对象的想法

4

1 回答 1

0

您需要将 3d 坐标转换为 2d 屏幕(投影)坐标。请查看此帖子以获取详细信息以及此处的答案。

于 2013-04-09T11:18:44.313 回答