B2G/gecko/browser/devtools/tilt/TiltVisualizer.jsm
/**
   * Picks a stacked dom node at the x and y screen coordinates and issues
   * a callback function with the found intersection.
   *
   * @param {Number} x
   *                 the current horizontal coordinate of the mouse
   * @param {Number} y
   *                 the current vertical coordinate of the mouse
   * @param {Object} aProperties
   *                 an object containing the following properties:
   *      {Function} onpick: function to be called at intersection
   *      {Function} onfail: function to be called if no intersections
   */
Picks a stacked dom node at the x and y screen coordinates and issues
a callback function with the found intersection.

@param {Number} x
the current horizontal coordinate of the mouse
@param {Number} y
the current vertical coordinate of the mouse
@param {Object} aProperties
an object containing the following properties:
{Function} onpick: function to be called at intersection
{Function} onfail: function to be called if no intersections
Picks a stacked dom node at the x and y screen coordinates and issues a callback function with the found intersection . @param { Number } x the current horizontal coordinate of the mouse @param { Number } y the current vertical coordinate of the mouse @param { Object } aProperties an object containing the following properties : { Function } onpick : function to be called at intersection { Function } onfail : function to be called if no intersections
function TVP_pickNode(x, y, aProperties)
  {
    aProperties = aProperties || {};
    if (!this._meshStacks || !this._meshWireframe) {
      return;
    }
    let worker = new ChromeWorker(TILT_PICKER);
    worker.addEventListener("message", function TVP_onMessage(event) {
      if (event.data) {
        if ("function" === typeof aProperties.onpick) {
          aProperties.onpick(event.data);
        }
      } else {
        if ("function" === typeof aProperties.onfail) {
          aProperties.onfail();
        }
      }
    }, false);
    let zoom = this.chromeWindow.InspectorUI.highlighter.zoom;
    let width = this._renderer.width * zoom;
    let height = this._renderer.height * zoom;
    x *= zoom;
    y *= zoom;
    worker.postMessage({
      thickness: STACK_THICKNESS,
      vertices: this._meshData.allVertices,
      ray: vec3.createRay([x, y, 0], [x, y, 1], [0, 0, width, height],
        this._meshStacks.mvMatrix,
        this._meshStacks.projMatrix)
    });
  }
function TVP_pickNode ( x , y , aProperties ) { aProperties = aProperties || { } ; if ( ! this . _meshStacks || ! this . _meshWireframe ) { return ; } let worker = new ChromeWorker ( TILT_PICKER ) ; worker . addEventListener ( "message" , function TVP_onMessage ( event ) { if ( event . data ) { if ( "function" === typeof aProperties . onpick ) { aProperties . onpick ( event . data ) ; } } else { if ( "function" === typeof aProperties . onfail ) { aProperties . onfail ( ) ; } } } , false ) ; let zoom = this . chromeWindow . InspectorUI . highlighter . zoom ; let width = this . _renderer . width * zoom ; let height = this . _renderer . height * zoom ; x *= zoom ; y *= zoom ; worker . postMessage ( { thickness : STACK_THICKNESS , vertices : this . _meshData . allVertices , ray : vec3 . createRay ( [ x , y , 0 ] , [ x , y , 1 ] , [ 0 , 0 , width , height ] , this . _meshStacks . mvMatrix , this . _meshStacks . projMatrix ) } ) ; }
Picks a stacked dom node at the x and y screen coordinates and issues
 a callback function with the found intersection.
Picks a stacked dom node at the x and y screen coordinates and issues a callback function with the found intersection .
// make sure the properties parameter is a valid object // if the mesh wasn't created yet, don't continue picking // create a ray following the mouse direction from the near clipping plane // to the far clipping plane, to check for intersections with the mesh, // and do all the heavy lifting in a separate thread // create the ray destined for 3D picking