MCPcopy Index your code
hub / github.com/shipshapecode/tether / _flipXTogether

Function _flipXTogether

src/js/constraint.js:163–208  ·  view source on GitHub ↗

* Flip X "together" * @param {object} tAttachment The target attachment * @param {object} eAttachment The element attachment * @param {number[]} bounds Array of bounds of the format [left, top, right, bottom] * @param {number} width * @param targetWidth * @param {number} left * @private

(tAttachment, eAttachment, bounds, width, targetWidth, left)

Source from the content-addressed store, hash-verified

161 * @private
162 */
163function _flipXTogether(tAttachment, eAttachment, bounds, width, targetWidth, left) {
164 if (left < bounds[0] && tAttachment.left === 'left') {
165 if (eAttachment.left === 'right') {
166 left += targetWidth;
167 tAttachment.left = 'right';
168
169 left += width;
170 eAttachment.left = 'left';
171
172 } else if (eAttachment.left === 'left') {
173 left += targetWidth;
174 tAttachment.left = 'right';
175
176 left -= width;
177 eAttachment.left = 'right';
178 }
179
180 } else if (left + width > bounds[2] && tAttachment.left === 'right') {
181 if (eAttachment.left === 'left') {
182 left -= targetWidth;
183 tAttachment.left = 'left';
184
185 left -= width;
186 eAttachment.left = 'right';
187
188 } else if (eAttachment.left === 'right') {
189 left -= targetWidth;
190 tAttachment.left = 'left';
191
192 left += width;
193 eAttachment.left = 'left';
194 }
195
196 } else if (tAttachment.left === 'center') {
197 if (left + width > bounds[2] && eAttachment.left === 'left') {
198 left -= width;
199 eAttachment.left = 'right';
200
201 } else if (left < bounds[0] && eAttachment.left === 'right') {
202 left += width;
203 eAttachment.left = 'left';
204 }
205 }
206
207 return left;
208}
209
210/**
211 * Flip Y "together"

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…