B2G/gecko/browser/devtools/tilt/TiltVisualizer.jsm
/**
   * Sets the corresponding highlight coordinates and color based on the
   * information supplied.
   *
   * @param {Number} aNodeIndex
   *                 the index of the node in the this._traverseData array
   * @param {String} aFlags
   *                 flags specifying highlighting options
   */
Sets the corresponding highlight coordinates and color based on the
information supplied.

@param {Number} aNodeIndex
the index of the node in the this._traverseData array
@param {String} aFlags
flags specifying highlighting options
Sets the corresponding highlight coordinates and color based on the information supplied . @param { Number } aNodeIndex the index of the node in the this . _traverseData array @param { String } aFlags flags specifying highlighting options
function TVP_highlightNodeFor(aNodeIndex, aFlags)
  {
    this._redraw = true;
    if (this._currentSelection === aNodeIndex) {
      return;
    }
    if (aNodeIndex < 0) {
      this._currentSelection = -1;
      this._highlight.disabled = true;
      Services.obs.notifyObservers(null, this.NOTIFICATIONS.UNHIGHLIGHTING, null);
      return;
    }
    let highlight = this._highlight;
    let info = this._traverseData.info[aNodeIndex];
    let node = this._traverseData.nodes[aNodeIndex];
    let style = TiltVisualizerStyle.nodes;
    highlight.disabled = false;
    highlight.fill = style[info.name] || style.highlight.defaultFill;
    highlight.stroke = style.highlight.defaultStroke;
    highlight.strokeWeight = style.highlight.defaultStrokeWeight;
    let x = info.coord.left;
    let y = info.coord.top;
    let w = info.coord.width;
    let h = info.coord.height;
    let z = info.depth;
    vec3.set([x,     y,     z * STACK_THICKNESS], highlight.v0);
    vec3.set([x + w, y,     z * STACK_THICKNESS], highlight.v1);
    vec3.set([x + w, y + h, z * STACK_THICKNESS], highlight.v2);
    vec3.set([x,     y + h, z * STACK_THICKNESS], highlight.v3);
    this._currentSelection = aNodeIndex;
    this.chromeWindow.InspectorUI.inspectNode(node,
      this.contentWindow.innerHeight < y ||
      this.contentWindow.pageYOffset > 0);
    if (aFlags && aFlags.indexOf("moveIntoView") !== -1)
    {
      this.controller.arcball.moveIntoView(vec3.lerp(
        vec3.scale(this._highlight.v0, this.transforms.zoom, []),
        vec3.scale(this._highlight.v1, this.transforms.zoom, []), 0.5));
    }
    Services.obs.notifyObservers(null, this.NOTIFICATIONS.HIGHLIGHTING, null);
  }
function TVP_highlightNodeFor ( aNodeIndex , aFlags ) { this . _redraw = true ; if ( this . _currentSelection === aNodeIndex ) { return ; } if ( aNodeIndex < 0 ) { this . _currentSelection = - 1 ; this . _highlight . disabled = true ; Services . obs . notifyObservers ( null , this . NOTIFICATIONS . UNHIGHLIGHTING , null ) ; return ; } let highlight = this . _highlight ; let info = this . _traverseData . info [ aNodeIndex ] ; let node = this . _traverseData . nodes [ aNodeIndex ] ; let style = TiltVisualizerStyle . nodes ; highlight . disabled = false ; highlight . fill = style [ info . name ] || style . highlight . defaultFill ; highlight . stroke = style . highlight . defaultStroke ; highlight . strokeWeight = style . highlight . defaultStrokeWeight ; let x = info . coord . left ; let y = info . coord . top ; let w = info . coord . width ; let h = info . coord . height ; let z = info . depth ; vec3 . set ( [ x , y , z * STACK_THICKNESS ] , highlight . v0 ) ; vec3 . set ( [ x + w , y , z * STACK_THICKNESS ] , highlight . v1 ) ; vec3 . set ( [ x + w , y + h , z * STACK_THICKNESS ] , highlight . v2 ) ; vec3 . set ( [ x , y + h , z * STACK_THICKNESS ] , highlight . v3 ) ; this . _currentSelection = aNodeIndex ; this . chromeWindow . InspectorUI . inspectNode ( node , this . contentWindow . innerHeight < y || this . contentWindow . pageYOffset > 0 ) ; if ( aFlags && aFlags . indexOf ( "moveIntoView" ) !== - 1 ) { this . controller . arcball . moveIntoView ( vec3 . lerp ( vec3 . scale ( this . _highlight . v0 , this . transforms . zoom , [ ] ) , vec3 . scale ( this . _highlight . v1 , this . transforms . zoom , [ ] ) , 0.5 ) ) ; } Services . obs . notifyObservers ( null , this . NOTIFICATIONS . HIGHLIGHTING , null ) ; }
Sets the corresponding highlight coordinates and color based on the
 information supplied.
Sets the corresponding highlight coordinates and color based on the information supplied .
// if the node was already selected, don't do anything // if an invalid or nonexisted node is specified, disable the highlight // if something is highlighted, make sure it's inside the current viewport; // the point which should be moved into view is considered the center [x, y] // position along the top edge of the currently selected node