function getOrigin(o, element) {
    const origin = o.origin;
    // First check if origin is in ox or originX
    let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center';
    let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center';

    // Then check if origin was used and overwrite in that case
    if (origin != null) {
  [ox, oy] = Array.isArray(origin)
        ? origin
        : typeof origin === 'object'
          ? [origin.x, origin.y]
          : [origin, origin];
    }

    // Make sure to only call bbox when actually needed
    const condX = typeof ox === 'string';
    const condY = typeof oy === 'string';
    if (condX || condY) {
      const { height, width, x, y } = element.bbox();

      // And only overwrite if string was passed for this specific axis
      if (condX) {
        ox = ox.includes('left')
          ? x
          : ox.includes('right')
            ? x + width
            : x + width / 2;
      }

      if (condY) {
        oy = oy.includes('top')
          ? y
          : oy.includes('bottom')
            ? y + height
            : y + height / 2;
      }
    }

    // Return the origin as it is if it wasn't a string
    return [ox, oy]
  }
This function adds support for string origins.
It searches for an origin in o.origin o.ox and o.originX.
This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50