title: Cytoscape.js - Get ".on(tap)" event position
body: <p>How to get the <code>tap</code> event position?</p>
  
  <p>Here, I'm trying to add a node on <code>tap</code>... but I couldn't figure out how to get the specific coordinates to pass to the <code>rendererPosition</code> property of the new node.</p>
  
  <pre><code>cy.on('tap', function (e) {
      if (e.cyTarget === cy) {                    
          //var pos = $(this).position().left,  //tried this, as jquery
          //posY = $(this).position().top;   //positioning without success        
          var idNum = cy.nodes().size();
          var setID = idNum.toString();
          cy.add([{
              group: "nodes",
              data: {
                  id: "n" + setID
              },
              renderedPosition: {
                  x: e.pageX, //- posX,
                  y: e.pageY //- posY
              },
          }]);                        
      }    
  });
  </code></pre>
  
  <p>Using the same code but binding with the <code>$('#cy').click</code> function, it works... but with <code>cy.on('tap')</code> way, the event <strong><code>e</code></strong> doesn't have the <code>pageX</code> and <code>pageY</code> properties, neither can I get the element position using the <code>$(this).position()</code> function.</p>
  
  <p>I really prefer using <code>tap</code>, as I'm trying to develop my application also for mobile interfaces.</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT: Using @darshanags observation and <a href="https://stackoverflow.com/questions/4780837/is-there-an-equivalent-to-e-pagex-position-for-touchstart-event-as-there-is-fo?rq=1">this link</a>, I solved this way:</p>
  
  <pre><code>var idNum = cy.nodes().size(),
      setID = idNum.toString(),
      offset = $("cy").offset(),
      position = {
          x: e.originalEvent.x - offset.left,
          y: e.originalEvent.y - offset.top
      };
  cy.add([{
      group: "nodes",
      data: { id: "n" + setID },
      renderedPosition: {
          x: position.x,
          y: position.y
      },
      ...
  }]);
  </code></pre>