src/utils.js
function(element) {
    var c={};
    try {
      var rect = element.getBoundingClientRect();
      c.x = Math.floor((rect.left + rect.right) / 2);
      c.y = Math.floor((rect.top + rect.bottom) / 2);
    } catch(e) {
      c.x = 1;
      c.y = 1;
    }
    return c;
  }
function(element) {
    var c={};
    try {
      var rect = element.getBoundingClientRect();
      c.x = Math.floor((rect.left + rect.right) / 2);
      c.y = Math.floor((rect.top + rect.bottom) / 2);
    } catch(e) {
      c.x = 1;
      c.y = 1;
    }
    return c;
  }
function ( element ) { var c = { } ; try { var rect = element . getBoundingClientRect ( ) ; c . x = Math . floor ( ( rect . left + rect . right ) / 2 ) ; c . y = Math . floor ( ( rect . top + rect . bottom ) / 2 ) ; } catch ( e ) { c . x = 1 ; c . y = 1 ; } return c ; }
Find the center of an element
Find the center of an element