function position(event) {
  var orientation;

  if (isString(event)) {
    orientation = event;

    return function(event) {
      var shape = event.shape;

      var x = event.x,
          y = event.y;

      if (/top/.test(orientation)) {
        y -= shape.height / 2;
      }

      if (/right/.test(orientation)) {
        x += shape.width / 2;
      }

      if (/bottom/.test(orientation)) {
        y += shape.height / 2;
      }

      if (/left/.test(orientation)) {
        x -= shape.width / 2;
      }

      return {
        x: x,
        y: y
      };
    };
  }

  return {
    x: event.x,
    y: event.y
  };
}
Returns x and y of an event. If called with string that specifies orientation if will return
x and y of specified orientation.

@param {Object|string} event - Event or orientation <top|right|bottom|left>

@return {Object}