code: function getSnapOffset(event, axis) {
    var context = event.context,
        shape = event.shape,
        gridSnappingContext = context.gridSnappingContext || {},
        snapLocation = gridSnappingContext.snapLocation;
  
    if (!shape || !snapLocation) {
      return 0;
    }
  
    if (axis === 'x') {
      if (/left/.test(snapLocation)) {
        return -shape.width / 2;
      }
  
      if (/right/.test(snapLocation)) {
        return shape.width / 2;
      }
    } else {
      if (/top/.test(snapLocation)) {
        return -shape.height / 2;
      }
  
      if (/bottom/.test(snapLocation)) {
        return shape.height / 2;
      }
    }
  
    return 0;
  }
docs: Get snap offset assuming that event is at center of shape.
  
  @param {Object} event
  @param {string} axis
  
  @returns {number}