All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scripts.node_modules.tether.src.js.shift.js Maven / Gradle / Ivy

There is a newer version: 2.14
Show newest version
/* globals TetherBase */

TetherBase.modules.push({
  position({top, left}) {
    if (!this.options.shift) {
      return;
    }

    let shift = this.options.shift;
    if (typeof this.options.shift === 'function') {
      shift = this.options.shift.call(this, {top, left});
    }

    let shiftTop, shiftLeft;
    if (typeof shift === 'string') {
      shift = shift.split(' ');
      shift[1] = shift[1] || shift[0];

      ([shiftTop, shiftLeft] = shift);

      shiftTop = parseFloat(shiftTop, 10);
      shiftLeft = parseFloat(shiftLeft, 10);
    } else {
      ([shiftTop, shiftLeft] = [shift.top, shift.left]);
    }

    top += shiftTop;
    left += shiftLeft;

    return {top, left};
  }
});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy