-1

i wan't to add context Menu when i right click on object 3D in scene

as this java script code

$(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>

this code i use it to create menu but can't find idea to make it relative to 3D object in scene

Mahmoud Elgohary
  • 789
  • 1
  • 8
  • 12
  • That's your job :) If you are having problems at some point, please be more specific what problem you need solved and what you have already tried. – yaku Apr 08 '13 at 22:07
  • i do it with Selector Class Name but how i can make it depended on mouse position in three.js scene – Mahmoud Elgohary Apr 09 '13 at 08:30

1 Answers1

0

You need to convert 3d coordinates to 2d screen (projected) coordinates. Please have a look at this post for details and also the answer here.

Community
  • 1
  • 1
George Profenza
  • 50,687
  • 19
  • 144
  • 218