Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
computeOffsets (placement) {
let { offsetX, offsetY } = this.props
if ((this.props.shouldAlignArrow || this.props.alignArrow) && this._view) {
const secondaryPlacement = parsePlacement(placement)[1]
const { arrowSize, arrowBorderWidth } = this._view.theme
const offsetAmount = (px(arrowSize) + px(arrowBorderWidth)) * 2
if (secondaryPlacement === 'start') {
offsetX = offsetAmount
} else if (secondaryPlacement === 'end') {
offsetX = -offsetAmount
} else if (secondaryPlacement === 'top') {
offsetY = offsetAmount
} else if (secondaryPlacement === 'bottom') {
offsetY = -offsetAmount
}
}
return { offsetX, offsetY }
}