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

Function _moveEdge

docs/app/js/sanddance-app.js:31799–31804  ·  view source on GitHub ↗

* Moves the edge of a rectangle to the value given. It only moves the edge in a linear direction based on that edge. * For example, if it's a bottom edge it will only change y coordinates.

(rect, edge, newValue)

Source from the content-addressed store, hash-verified

31797 * Moves the edge of a rectangle to the value given. It only moves the edge in a linear direction based on that edge.
31798 * For example, if it's a bottom edge it will only change y coordinates.
31799 */ function _moveEdge(rect, edge, newValue) {
31800 var difference = _getEdgeValue(rect, edge) - newValue;
31801 rect = _setEdgeValue(rect, edge, newValue);
31802 rect = _setEdgeValue(rect, edge * -1, _getEdgeValue(rect, edge * -1) - difference);
31803 return rect;
31804}
31805/**
31806 * Aligns the edge on the passed in rect to the target. If there is a gap then it will have that space between the two.
31807 */ function _alignEdges(rect, target, edge, gap) {

Callers 4

_alignEdgesFunction · 0.85
_alignOppositeEdgesFunction · 0.85
_centerEdgeToPointFunction · 0.85
_positionBeakFunction · 0.85

Calls 2

_getEdgeValueFunction · 0.85
_setEdgeValueFunction · 0.85

Tested by

no test coverage detected