0

jQuery dialog is not working while using in three.js. I'm trying to implement a click event on a Circle(using Circle Geometry) using jQuery. But it not supporting. Here is my code:

function onDocumentMouseDown(event) {
    event.preventDefault();

    var vector = new THREE.Vector3((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1, 0.5);
    vector = vector.unproject(camera);

    var raycaster = new THREE.Raycaster(camera.position, vector.sub(camera.position).normalize());
    var intersects = raycaster.intersectObjects(sphereMesh.children, true);

    if (intersects.length > 0) {
        console.log(intersects[0]);
        if (intersects[0].object.name == "mesh") {
            contactus();
        }
    }

}

function contactus() {
    $("#dialog-message").dialog({
        draggable: true,
        show: {
            effect: "blind",
            duration: 1000
        },
        hide: {
            effect: "explode",
            duration: 1000
        }
    });
 }

I'm not able to see the content in the dialog. But I can see the dialog with "close" button. And mouse click is not working on the dialog.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
disciple
  • 252
  • 1
  • 3
  • 13
  • You need to document.addEventListener( 'mousedown', onDocumentMouseDown, false ); this post may help further http://stackoverflow.com/questions/7984471/how-to-get-clicked-element-in-three-js – Anil Jun 04 '15 at 07:12
  • yaa i did that before.. – disciple Jun 04 '15 at 07:14
  • thank you Anil.. I have already seen that link... I'm not facing problem with the raycaster or any mousedown event.. I'm facing problem with jQuery dialog – disciple Jun 04 '15 at 07:16

1 Answers1

0

Content has nothing to do with jQuery dialog , you can try it by adding any hardcoded constant, for events to work you need to bind these with buttons like,

$( #dialog-message" ).dialog({
  dialogClass: "no-close",
  buttons: [
    {
      text: "OK",
      click: function() {
        $( this ).dialog( "close" );
      }
    }
  ]
});

Further you can refer api, https://api.jqueryui.com/dialog/

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Anil
  • 3,722
  • 2
  • 24
  • 49