function renderedPosition(dim, val) {
    var ele = this[0];
    var cy = this.cy();
    var zoom = cy.zoom();
    var pan = cy.pan();
    var rpos = plainObject(dim) ? dim : undefined;
    var setting = rpos !== undefined || val !== undefined && string(dim);

    if (ele && ele.isNode()) {
      // must have an element and must be a node to return position
      if (setting) {
        for (var i = 0; i < this.length; i++) {
          var _ele = this[i];

          if (val !== undefined) {
            // set one dimension
            _ele.position(dim, (val - pan[dim]) / zoom);
          } else if (rpos !== undefined) {
            // set whole position
            _ele.position(renderedToModelPosition(rpos, zoom, pan));
          }
        }
      } else {
        // getting
        var pos = ele.position();
        rpos = modelToRenderedPosition(pos, zoom, pan);

        if (dim === undefined) {
          // then return the whole rendered position
          return rpos;
        } else {
          // then return the specified dimension
          return rpos[dim];
        }
      }
    } else if (!setting) {
      return undefined; // for empty collection case
    }

    return this; // chaining
  }
function renderedPosition(dim, val) {
    var ele = this[0];
    var cy = this.cy();
    var zoom = cy.zoom();
    var pan = cy.pan();
    var rpos = plainObject(dim) ? dim : undefined;
    var setting = rpos !== undefined || val !== undefined && string(dim);

    if (ele && ele.isNode()) {
      // must have an element and must be a node to return position
      if (setting) {
        for (var i = 0; i < this.length; i++) {
          var _ele = this[i];

          if (val !== undefined) {
            // set one dimension
            _ele.position(dim, (val - pan[dim]) / zoom);
          } else if (rpos !== undefined) {
            // set whole position
            _ele.position(renderedToModelPosition(rpos, zoom, pan));
          }
        }
      } else {
        // getting
        var pos = ele.position();
        rpos = modelToRenderedPosition(pos, zoom, pan);

        if (dim === undefined) {
          // then return the whole rendered position
          return rpos;
        } else {
          // then return the specified dimension
          return rpos[dim];
        }
      }
    } else if (!setting) {
      return undefined; // for empty collection case
    }

    return this; // chaining
  }
function renderedPosition ( dim , val ) { var ele = this [ 0 ] ; var cy = this . cy ( ) ; var zoom = cy . zoom ( ) ; var pan = cy . pan ( ) ; var rpos = plainObject ( dim ) ? dim : undefined ; var setting = rpos !== undefined || val !== undefined && string ( dim ) ; if ( ele && ele . isNode ( ) ) { // must have an element and must be a node to return position if ( setting ) { for ( var i = 0 ; i < this . length ; i ++ ) { var _ele = this [ i ] ; if ( val !== undefined ) { // set one dimension _ele . position ( dim , ( val - pan [ dim ] ) / zoom ) ; } else if ( rpos !== undefined ) { // set whole position _ele . position ( renderedToModelPosition ( rpos , zoom , pan ) ) ; } } } else { // getting var pos = ele . position ( ) ; rpos = modelToRenderedPosition ( pos , zoom , pan ) ; if ( dim === undefined ) { // then return the whole rendered position return rpos ; } else { // then return the specified dimension return rpos [ dim ] ; } } } else if ( ! setting ) { return undefined ; // for empty collection case } return this ; // chaining }
get/set the rendered (i.e. on screen) positon of the element
get / set the rendered ( i . e . on screen ) positon of the element
Returns the rendered position of an element in the specified dimension.