MCPcopy Index your code
hub / github.com/docker/getting-started / getRoundedOffsets

Function getRoundedOffsets

app/src/static/js/react-bootstrap.js:4216–4241  ·  view source on GitHub ↗

* @function * @memberof Popper.Utils * @argument {Object} data - The data object generated by `update` method * @argument {Boolean} shouldRound - If the offsets should be rounded at all * @returns {Object} The popper's position offsets rounded * * The tale of pixel-perfect positioning. It's st

(data, shouldRound)

Source from the content-addressed store, hash-verified

4214
4215
4216function getRoundedOffsets(data, shouldRound) {
4217 var _data$offsets = data.offsets,
4218 popper = _data$offsets.popper,
4219 reference = _data$offsets.reference;
4220 var round = Math.round,
4221 floor = Math.floor;
4222
4223 var noRound = function noRound(v) {
4224 return v;
4225 };
4226
4227 var referenceWidth = round(reference.width);
4228 var popperWidth = round(popper.width);
4229 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
4230 var isVariation = data.placement.indexOf('-') !== -1;
4231 var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
4232 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
4233 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
4234 var verticalToInteger = !shouldRound ? noRound : round;
4235 return {
4236 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
4237 top: verticalToInteger(popper.top),
4238 bottom: verticalToInteger(popper.bottom),
4239 right: horizontalToInteger(popper.right)
4240 };
4241}
4242
4243var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
4244/**

Callers 1

computeStyleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…