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

Function _centerEdgeToPoint

docs/app/js/sanddance-app.js:31930–31935  ·  view source on GitHub ↗

* Moves the middle point on an edge to the point given. * Only moves in one direction. For instance if a bottom edge is passed in, then * the bottom edge will be moved in the x axis to match the point.

(rect, edge, point)

Source from the content-addressed store, hash-verified

31928 * Only moves in one direction. For instance if a bottom edge is passed in, then
31929 * the bottom edge will be moved in the x axis to match the point.
31930 */ function _centerEdgeToPoint(rect, edge, point) {
31931 var positiveEdge = _getFlankingEdges(edge).positiveEdge;
31932 var elementMiddle = _getCenterValue(rect, edge);
31933 var distanceToMiddle = elementMiddle - _getEdgeValue(rect, positiveEdge);
31934 return _moveEdge(rect, positiveEdge, point - distanceToMiddle);
31935}
31936/**
31937 * Moves the element rectangle to be appropriately positioned relative to a given target.
31938 * Does not flip or adjust the element.

Callers 2

_estimatePositionFunction · 0.85
_positionBeakFunction · 0.85

Calls 4

_getFlankingEdgesFunction · 0.85
_getCenterValueFunction · 0.85
_getEdgeValueFunction · 0.85
_moveEdgeFunction · 0.85

Tested by

no test coverage detected