plain-draggable-limit.esm.js
function move(props, position, cbCheck) {
  var elementBBox = props.elementBBox;

  function fix() {
    if (props.minLeft >= props.maxLeft) {
      // Disabled
      position.left = elementBBox.left;
    } else if (position.left < props.minLeft) {
      position.left = props.minLeft;
    } else if (position.left > props.maxLeft) {
      position.left = props.maxLeft;
    }
    if (props.minTop >= props.maxTop) {
      // Disabled
      position.top = elementBBox.top;
    } else if (position.top < props.minTop) {
      position.top = props.minTop;
    } else if (position.top > props.maxTop) {
      position.top = props.maxTop;
    }
  }

  fix();
  if (cbCheck) {
    if (cbCheck(position) === false) {
      return false;
    }
    fix(); // Again
  }

  var moved = props.moveElm(props, position);
  if (moved) {
    // Update elementBBox
    props.elementBBox = validBBox({ left: position.left, top: position.top,
      width: elementBBox.width, height: elementBBox.height });
  }
  return moved;
}
function move(props, position, cbCheck) {
  var elementBBox = props.elementBBox;

  function fix() {
    if (props.minLeft >= props.maxLeft) {
      // Disabled
      position.left = elementBBox.left;
    } else if (position.left < props.minLeft) {
      position.left = props.minLeft;
    } else if (position.left > props.maxLeft) {
      position.left = props.maxLeft;
    }
    if (props.minTop >= props.maxTop) {
      // Disabled
      position.top = elementBBox.top;
    } else if (position.top < props.minTop) {
      position.top = props.minTop;
    } else if (position.top > props.maxTop) {
      position.top = props.maxTop;
    }
  }

  fix();
  if (cbCheck) {
    if (cbCheck(position) === false) {
      return false;
    }
    fix(); // Again
  }

  var moved = props.moveElm(props, position);
  if (moved) {
    // Update elementBBox
    props.elementBBox = validBBox({ left: position.left, top: position.top,
      width: elementBBox.width, height: elementBBox.height });
  }
  return moved;
}
function move ( props , position , cbCheck ) { var elementBBox = props . elementBBox ; function fix ( ) { if ( props . minLeft >= props . maxLeft ) { // Disabled position . left = elementBBox . left ; } else if ( position . left < props . minLeft ) { position . left = props . minLeft ; } else if ( position . left > props . maxLeft ) { position . left = props . maxLeft ; } if ( props . minTop >= props . maxTop ) { // Disabled position . top = elementBBox . top ; } else if ( position . top < props . minTop ) { position . top = props . minTop ; } else if ( position . top > props . maxTop ) { position . top = props . maxTop ; } } fix ( ) ; if ( cbCheck ) { if ( cbCheck ( position ) === false ) { return false ; } fix ( ) ; // Again } var moved = props . moveElm ( props , position ) ; if ( moved ) { // Update elementBBox props . elementBBox = validBBox ( { left : position . left , top : position . top , width : elementBBox . width , height : elementBBox . height } ) ; } return moved ; }
Set `props.element` position.
@param {props} props - `props` of instance.
@param {{left: number, top: number}} position - New position.
@param {function} [cbCheck] - Callback that is called with valid position, cancel moving if it returns `false`.
@returns {boolean} `true` if it was moved.
Set props . element position .