MCPcopy Create free account
hub / github.com/microsoft/SandDance / getClosestEdge

Function getClosestEdge

docs/app/js/sanddance-app.js:32026–32032  ·  view source on GitHub ↗
(targetEdge, target, boundingRect)

Source from the content-addressed store, hash-verified

32024 return positionData;
32025}
32026function getClosestEdge(targetEdge, target, boundingRect) {
32027 var targetCenter = _getCenterValue(target, targetEdge);
32028 var boundingCenter = _getCenterValue(boundingRect, targetEdge);
32029 var _a1 = _getFlankingEdges(targetEdge), positiveEdge = _a1.positiveEdge, negativeEdge = _a1.negativeEdge;
32030 if (targetCenter <= boundingCenter) return positiveEdge;
32031 else return negativeEdge;
32032}
32033function _positionElementWithinBounds(elementToPosition, target, bounding, positionData, gap, directionalHintFixed, coverTarget) {
32034 var estimatedElementPosition = _estimatePosition(elementToPosition, target, positionData, gap, coverTarget);
32035 if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) return {

Callers 2

_getAlignmentDataFunction · 0.85
_finalizeBeakPositionFunction · 0.85

Calls 2

_getCenterValueFunction · 0.85
_getFlankingEdgesFunction · 0.85

Tested by

no test coverage detected