MCPcopy Create free account
hub / github.com/shipshapecode/tether / _calculateOOBAndPinnedLeft

Function _calculateOOBAndPinnedLeft

src/js/constraint.js:97–117  ·  view source on GitHub ↗

* Calculates if out of bounds or pinned in the X direction. * * @param {number} left * @param {number[]} bounds Array of bounds of the format [left, top, right, bottom] * @param {number} width * @param pin * @param pinned * @param {string[]} oob * @return {number} * @private

(left, bounds, width, pin, pinned, oob)

Source from the content-addressed store, hash-verified

95 * @private
96 */
97function _calculateOOBAndPinnedLeft(left, bounds, width, pin, pinned, oob) {
98 if (left < bounds[0]) {
99 if (pin.indexOf('left') >= 0) {
100 left = bounds[0];
101 pinned.push('left');
102 } else {
103 oob.push('left');
104 }
105 }
106
107 if (left + width > bounds[2]) {
108 if (pin.indexOf('right') >= 0) {
109 left = bounds[2] - width;
110 pinned.push('right');
111 } else {
112 oob.push('right');
113 }
114 }
115
116 return left;
117}
118
119/**
120 * Calculates if out of bounds or pinned in the Y direction.

Callers 2

constraint.spec.jsFile · 0.85
positionFunction · 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…