Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes/tether
File: tether.js
[1000] Fix | Delete
// Get an actual px offset from the attachment
[1001] Fix | Delete
var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
[1002] Fix | Delete
var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
[1003] Fix | Delete
[1004] Fix | Delete
var manualOffset = offsetToPx(this.offset, { width: width, height: height });
[1005] Fix | Delete
var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
[1006] Fix | Delete
[1007] Fix | Delete
// Add the manually provided offset
[1008] Fix | Delete
offset = addOffset(offset, manualOffset);
[1009] Fix | Delete
targetOffset = addOffset(targetOffset, manualTargetOffset);
[1010] Fix | Delete
[1011] Fix | Delete
// It's now our goal to make (element position + offset) == (target position + target offset)
[1012] Fix | Delete
var left = targetPos.left + targetOffset.left - offset.left;
[1013] Fix | Delete
var top = targetPos.top + targetOffset.top - offset.top;
[1014] Fix | Delete
[1015] Fix | Delete
for (var i = 0; i < TetherBase.modules.length; ++i) {
[1016] Fix | Delete
var _module2 = TetherBase.modules[i];
[1017] Fix | Delete
var ret = _module2.position.call(this, {
[1018] Fix | Delete
left: left,
[1019] Fix | Delete
top: top,
[1020] Fix | Delete
targetAttachment: targetAttachment,
[1021] Fix | Delete
targetPos: targetPos,
[1022] Fix | Delete
elementPos: elementPos,
[1023] Fix | Delete
offset: offset,
[1024] Fix | Delete
targetOffset: targetOffset,
[1025] Fix | Delete
manualOffset: manualOffset,
[1026] Fix | Delete
manualTargetOffset: manualTargetOffset,
[1027] Fix | Delete
scrollbarSize: scrollbarSize,
[1028] Fix | Delete
attachment: this.attachment
[1029] Fix | Delete
});
[1030] Fix | Delete
[1031] Fix | Delete
if (ret === false) {
[1032] Fix | Delete
return false;
[1033] Fix | Delete
} else if (typeof ret === 'undefined' || typeof ret !== 'object') {
[1034] Fix | Delete
continue;
[1035] Fix | Delete
} else {
[1036] Fix | Delete
top = ret.top;
[1037] Fix | Delete
left = ret.left;
[1038] Fix | Delete
}
[1039] Fix | Delete
}
[1040] Fix | Delete
[1041] Fix | Delete
// We describe the position three different ways to give the optimizer
[1042] Fix | Delete
// a chance to decide the best possible way to position the element
[1043] Fix | Delete
// with the fewest repaints.
[1044] Fix | Delete
var next = {
[1045] Fix | Delete
// It's position relative to the page (absolute positioning when
[1046] Fix | Delete
// the element is a child of the body)
[1047] Fix | Delete
page: {
[1048] Fix | Delete
top: top,
[1049] Fix | Delete
left: left
[1050] Fix | Delete
},
[1051] Fix | Delete
[1052] Fix | Delete
// It's position relative to the viewport (fixed positioning)
[1053] Fix | Delete
viewport: {
[1054] Fix | Delete
top: top - pageYOffset,
[1055] Fix | Delete
bottom: pageYOffset - top - height + innerHeight,
[1056] Fix | Delete
left: left - pageXOffset,
[1057] Fix | Delete
right: pageXOffset - left - width + innerWidth
[1058] Fix | Delete
}
[1059] Fix | Delete
};
[1060] Fix | Delete
[1061] Fix | Delete
var doc = this.target.ownerDocument;
[1062] Fix | Delete
var win = doc.defaultView;
[1063] Fix | Delete
[1064] Fix | Delete
var scrollbarSize = undefined;
[1065] Fix | Delete
if (win.innerHeight > doc.documentElement.clientHeight) {
[1066] Fix | Delete
scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
[1067] Fix | Delete
next.viewport.bottom -= scrollbarSize.height;
[1068] Fix | Delete
}
[1069] Fix | Delete
[1070] Fix | Delete
if (win.innerWidth > doc.documentElement.clientWidth) {
[1071] Fix | Delete
scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
[1072] Fix | Delete
next.viewport.right -= scrollbarSize.width;
[1073] Fix | Delete
}
[1074] Fix | Delete
[1075] Fix | Delete
if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
[1076] Fix | Delete
// Absolute positioning in the body will be relative to the page, not the 'initial containing block'
[1077] Fix | Delete
next.page.bottom = doc.body.scrollHeight - top - height;
[1078] Fix | Delete
next.page.right = doc.body.scrollWidth - left - width;
[1079] Fix | Delete
}
[1080] Fix | Delete
[1081] Fix | Delete
if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
[1082] Fix | Delete
(function () {
[1083] Fix | Delete
var offsetParent = _this7.cache('target-offsetparent', function () {
[1084] Fix | Delete
return getOffsetParent(_this7.target);
[1085] Fix | Delete
});
[1086] Fix | Delete
var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
[1087] Fix | Delete
return getBounds(offsetParent);
[1088] Fix | Delete
});
[1089] Fix | Delete
var offsetParentStyle = getComputedStyle(offsetParent);
[1090] Fix | Delete
var offsetParentSize = offsetPosition;
[1091] Fix | Delete
[1092] Fix | Delete
var offsetBorder = {};
[1093] Fix | Delete
['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
[1094] Fix | Delete
offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
[1095] Fix | Delete
});
[1096] Fix | Delete
[1097] Fix | Delete
offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
[1098] Fix | Delete
offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
[1099] Fix | Delete
[1100] Fix | Delete
if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
[1101] Fix | Delete
if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
[1102] Fix | Delete
// We're within the visible part of the target's scroll parent
[1103] Fix | Delete
var scrollTop = offsetParent.scrollTop;
[1104] Fix | Delete
var scrollLeft = offsetParent.scrollLeft;
[1105] Fix | Delete
[1106] Fix | Delete
// It's position relative to the target's offset parent (absolute positioning when
[1107] Fix | Delete
// the element is moved to be a child of the target's offset parent).
[1108] Fix | Delete
next.offset = {
[1109] Fix | Delete
top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
[1110] Fix | Delete
left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
[1111] Fix | Delete
};
[1112] Fix | Delete
}
[1113] Fix | Delete
}
[1114] Fix | Delete
})();
[1115] Fix | Delete
}
[1116] Fix | Delete
[1117] Fix | Delete
// We could also travel up the DOM and try each containing context, rather than only
[1118] Fix | Delete
// looking at the body, but we're gonna get diminishing returns.
[1119] Fix | Delete
[1120] Fix | Delete
this.move(next);
[1121] Fix | Delete
[1122] Fix | Delete
this.history.unshift(next);
[1123] Fix | Delete
[1124] Fix | Delete
if (this.history.length > 3) {
[1125] Fix | Delete
this.history.pop();
[1126] Fix | Delete
}
[1127] Fix | Delete
[1128] Fix | Delete
if (flushChanges) {
[1129] Fix | Delete
flush();
[1130] Fix | Delete
}
[1131] Fix | Delete
[1132] Fix | Delete
return true;
[1133] Fix | Delete
}
[1134] Fix | Delete
[1135] Fix | Delete
// THE ISSUE
[1136] Fix | Delete
}, {
[1137] Fix | Delete
key: 'move',
[1138] Fix | Delete
value: function move(pos) {
[1139] Fix | Delete
var _this8 = this;
[1140] Fix | Delete
[1141] Fix | Delete
if (!(typeof this.element.parentNode !== 'undefined')) {
[1142] Fix | Delete
return;
[1143] Fix | Delete
}
[1144] Fix | Delete
[1145] Fix | Delete
var same = {};
[1146] Fix | Delete
[1147] Fix | Delete
for (var type in pos) {
[1148] Fix | Delete
same[type] = {};
[1149] Fix | Delete
[1150] Fix | Delete
for (var key in pos[type]) {
[1151] Fix | Delete
var found = false;
[1152] Fix | Delete
[1153] Fix | Delete
for (var i = 0; i < this.history.length; ++i) {
[1154] Fix | Delete
var point = this.history[i];
[1155] Fix | Delete
if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
[1156] Fix | Delete
found = true;
[1157] Fix | Delete
break;
[1158] Fix | Delete
}
[1159] Fix | Delete
}
[1160] Fix | Delete
[1161] Fix | Delete
if (!found) {
[1162] Fix | Delete
same[type][key] = true;
[1163] Fix | Delete
}
[1164] Fix | Delete
}
[1165] Fix | Delete
}
[1166] Fix | Delete
[1167] Fix | Delete
var css = { top: '', left: '', right: '', bottom: '' };
[1168] Fix | Delete
[1169] Fix | Delete
var transcribe = function transcribe(_same, _pos) {
[1170] Fix | Delete
var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
[1171] Fix | Delete
var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
[1172] Fix | Delete
if (gpu !== false) {
[1173] Fix | Delete
var yPos = undefined,
[1174] Fix | Delete
xPos = undefined;
[1175] Fix | Delete
if (_same.top) {
[1176] Fix | Delete
css.top = 0;
[1177] Fix | Delete
yPos = _pos.top;
[1178] Fix | Delete
} else {
[1179] Fix | Delete
css.bottom = 0;
[1180] Fix | Delete
yPos = -_pos.bottom;
[1181] Fix | Delete
}
[1182] Fix | Delete
[1183] Fix | Delete
if (_same.left) {
[1184] Fix | Delete
css.left = 0;
[1185] Fix | Delete
xPos = _pos.left;
[1186] Fix | Delete
} else {
[1187] Fix | Delete
css.right = 0;
[1188] Fix | Delete
xPos = -_pos.right;
[1189] Fix | Delete
}
[1190] Fix | Delete
[1191] Fix | Delete
if (typeof window.devicePixelRatio === 'number' && devicePixelRatio % 1 === 0) {
[1192] Fix | Delete
xPos = Math.round(xPos * devicePixelRatio) / devicePixelRatio;
[1193] Fix | Delete
yPos = Math.round(yPos * devicePixelRatio) / devicePixelRatio;
[1194] Fix | Delete
}
[1195] Fix | Delete
[1196] Fix | Delete
css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
[1197] Fix | Delete
[1198] Fix | Delete
if (transformKey !== 'msTransform') {
[1199] Fix | Delete
// The Z transform will keep this in the GPU (faster, and prevents artifacts),
[1200] Fix | Delete
// but IE9 doesn't support 3d transforms and will choke.
[1201] Fix | Delete
css[transformKey] += " translateZ(0)";
[1202] Fix | Delete
}
[1203] Fix | Delete
} else {
[1204] Fix | Delete
if (_same.top) {
[1205] Fix | Delete
css.top = _pos.top + 'px';
[1206] Fix | Delete
} else {
[1207] Fix | Delete
css.bottom = _pos.bottom + 'px';
[1208] Fix | Delete
}
[1209] Fix | Delete
[1210] Fix | Delete
if (_same.left) {
[1211] Fix | Delete
css.left = _pos.left + 'px';
[1212] Fix | Delete
} else {
[1213] Fix | Delete
css.right = _pos.right + 'px';
[1214] Fix | Delete
}
[1215] Fix | Delete
}
[1216] Fix | Delete
};
[1217] Fix | Delete
[1218] Fix | Delete
var moved = false;
[1219] Fix | Delete
if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
[1220] Fix | Delete
css.position = 'absolute';
[1221] Fix | Delete
transcribe(same.page, pos.page);
[1222] Fix | Delete
} else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
[1223] Fix | Delete
css.position = 'fixed';
[1224] Fix | Delete
transcribe(same.viewport, pos.viewport);
[1225] Fix | Delete
} else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
[1226] Fix | Delete
(function () {
[1227] Fix | Delete
css.position = 'absolute';
[1228] Fix | Delete
var offsetParent = _this8.cache('target-offsetparent', function () {
[1229] Fix | Delete
return getOffsetParent(_this8.target);
[1230] Fix | Delete
});
[1231] Fix | Delete
[1232] Fix | Delete
if (getOffsetParent(_this8.element) !== offsetParent) {
[1233] Fix | Delete
defer(function () {
[1234] Fix | Delete
_this8.element.parentNode.removeChild(_this8.element);
[1235] Fix | Delete
offsetParent.appendChild(_this8.element);
[1236] Fix | Delete
});
[1237] Fix | Delete
}
[1238] Fix | Delete
[1239] Fix | Delete
transcribe(same.offset, pos.offset);
[1240] Fix | Delete
moved = true;
[1241] Fix | Delete
})();
[1242] Fix | Delete
} else {
[1243] Fix | Delete
css.position = 'absolute';
[1244] Fix | Delete
transcribe({ top: true, left: true }, pos.page);
[1245] Fix | Delete
}
[1246] Fix | Delete
[1247] Fix | Delete
if (!moved) {
[1248] Fix | Delete
if (this.options.bodyElement) {
[1249] Fix | Delete
if (this.element.parentNode !== this.options.bodyElement) {
[1250] Fix | Delete
this.options.bodyElement.appendChild(this.element);
[1251] Fix | Delete
}
[1252] Fix | Delete
} else {
[1253] Fix | Delete
var isFullscreenElement = function isFullscreenElement(e) {
[1254] Fix | Delete
var d = e.ownerDocument;
[1255] Fix | Delete
var fe = d.fullscreenElement || d.webkitFullscreenElement || d.mozFullScreenElement || d.msFullscreenElement;
[1256] Fix | Delete
return fe === e;
[1257] Fix | Delete
};
[1258] Fix | Delete
[1259] Fix | Delete
var offsetParentIsBody = true;
[1260] Fix | Delete
[1261] Fix | Delete
var currentNode = this.element.parentNode;
[1262] Fix | Delete
while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY' && !isFullscreenElement(currentNode)) {
[1263] Fix | Delete
if (getComputedStyle(currentNode).position !== 'static') {
[1264] Fix | Delete
offsetParentIsBody = false;
[1265] Fix | Delete
break;
[1266] Fix | Delete
}
[1267] Fix | Delete
[1268] Fix | Delete
currentNode = currentNode.parentNode;
[1269] Fix | Delete
}
[1270] Fix | Delete
[1271] Fix | Delete
if (!offsetParentIsBody) {
[1272] Fix | Delete
this.element.parentNode.removeChild(this.element);
[1273] Fix | Delete
this.element.ownerDocument.body.appendChild(this.element);
[1274] Fix | Delete
}
[1275] Fix | Delete
}
[1276] Fix | Delete
}
[1277] Fix | Delete
[1278] Fix | Delete
// Any css change will trigger a repaint, so let's avoid one if nothing changed
[1279] Fix | Delete
var writeCSS = {};
[1280] Fix | Delete
var write = false;
[1281] Fix | Delete
for (var key in css) {
[1282] Fix | Delete
var val = css[key];
[1283] Fix | Delete
var elVal = this.element.style[key];
[1284] Fix | Delete
[1285] Fix | Delete
if (elVal !== val) {
[1286] Fix | Delete
write = true;
[1287] Fix | Delete
writeCSS[key] = val;
[1288] Fix | Delete
}
[1289] Fix | Delete
}
[1290] Fix | Delete
[1291] Fix | Delete
if (write) {
[1292] Fix | Delete
defer(function () {
[1293] Fix | Delete
extend(_this8.element.style, writeCSS);
[1294] Fix | Delete
_this8.trigger('repositioned');
[1295] Fix | Delete
});
[1296] Fix | Delete
}
[1297] Fix | Delete
}
[1298] Fix | Delete
}]);
[1299] Fix | Delete
[1300] Fix | Delete
return TetherClass;
[1301] Fix | Delete
})(Evented);
[1302] Fix | Delete
[1303] Fix | Delete
TetherClass.modules = [];
[1304] Fix | Delete
[1305] Fix | Delete
TetherBase.position = position;
[1306] Fix | Delete
[1307] Fix | Delete
var Tether = extend(TetherClass, TetherBase);
[1308] Fix | Delete
/* globals TetherBase */
[1309] Fix | Delete
[1310] Fix | Delete
'use strict';
[1311] Fix | Delete
[1312] Fix | Delete
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
[1313] Fix | Delete
[1314] Fix | Delete
var _TetherBase$Utils = TetherBase.Utils;
[1315] Fix | Delete
var getBounds = _TetherBase$Utils.getBounds;
[1316] Fix | Delete
var extend = _TetherBase$Utils.extend;
[1317] Fix | Delete
var updateClasses = _TetherBase$Utils.updateClasses;
[1318] Fix | Delete
var defer = _TetherBase$Utils.defer;
[1319] Fix | Delete
[1320] Fix | Delete
var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
[1321] Fix | Delete
[1322] Fix | Delete
function getBoundingRect(tether, to) {
[1323] Fix | Delete
if (to === 'scrollParent') {
[1324] Fix | Delete
to = tether.scrollParents[0];
[1325] Fix | Delete
} else if (to === 'window') {
[1326] Fix | Delete
to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
[1327] Fix | Delete
}
[1328] Fix | Delete
[1329] Fix | Delete
if (to === document) {
[1330] Fix | Delete
to = to.documentElement;
[1331] Fix | Delete
}
[1332] Fix | Delete
[1333] Fix | Delete
if (typeof to.nodeType !== 'undefined') {
[1334] Fix | Delete
(function () {
[1335] Fix | Delete
var node = to;
[1336] Fix | Delete
var size = getBounds(to);
[1337] Fix | Delete
var pos = size;
[1338] Fix | Delete
var style = getComputedStyle(to);
[1339] Fix | Delete
[1340] Fix | Delete
to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
[1341] Fix | Delete
[1342] Fix | Delete
// Account any parent Frames scroll offset
[1343] Fix | Delete
if (node.ownerDocument !== document) {
[1344] Fix | Delete
var win = node.ownerDocument.defaultView;
[1345] Fix | Delete
to[0] += win.pageXOffset;
[1346] Fix | Delete
to[1] += win.pageYOffset;
[1347] Fix | Delete
to[2] += win.pageXOffset;
[1348] Fix | Delete
to[3] += win.pageYOffset;
[1349] Fix | Delete
}
[1350] Fix | Delete
[1351] Fix | Delete
BOUNDS_FORMAT.forEach(function (side, i) {
[1352] Fix | Delete
side = side[0].toUpperCase() + side.substr(1);
[1353] Fix | Delete
if (side === 'Top' || side === 'Left') {
[1354] Fix | Delete
to[i] += parseFloat(style['border' + side + 'Width']);
[1355] Fix | Delete
} else {
[1356] Fix | Delete
to[i] -= parseFloat(style['border' + side + 'Width']);
[1357] Fix | Delete
}
[1358] Fix | Delete
});
[1359] Fix | Delete
})();
[1360] Fix | Delete
}
[1361] Fix | Delete
[1362] Fix | Delete
return to;
[1363] Fix | Delete
}
[1364] Fix | Delete
[1365] Fix | Delete
TetherBase.modules.push({
[1366] Fix | Delete
position: function position(_ref) {
[1367] Fix | Delete
var _this = this;
[1368] Fix | Delete
[1369] Fix | Delete
var top = _ref.top;
[1370] Fix | Delete
var left = _ref.left;
[1371] Fix | Delete
var targetAttachment = _ref.targetAttachment;
[1372] Fix | Delete
[1373] Fix | Delete
if (!this.options.constraints) {
[1374] Fix | Delete
return true;
[1375] Fix | Delete
}
[1376] Fix | Delete
[1377] Fix | Delete
var _cache = this.cache('element-bounds', function () {
[1378] Fix | Delete
return getBounds(_this.element);
[1379] Fix | Delete
});
[1380] Fix | Delete
[1381] Fix | Delete
var height = _cache.height;
[1382] Fix | Delete
var width = _cache.width;
[1383] Fix | Delete
[1384] Fix | Delete
if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
[1385] Fix | Delete
var _lastSize = this.lastSize;
[1386] Fix | Delete
[1387] Fix | Delete
// Handle the item getting hidden as a result of our positioning without glitching
[1388] Fix | Delete
// the classes in and out
[1389] Fix | Delete
width = _lastSize.width;
[1390] Fix | Delete
height = _lastSize.height;
[1391] Fix | Delete
}
[1392] Fix | Delete
[1393] Fix | Delete
var targetSize = this.cache('target-bounds', function () {
[1394] Fix | Delete
return _this.getTargetBounds();
[1395] Fix | Delete
});
[1396] Fix | Delete
[1397] Fix | Delete
var targetHeight = targetSize.height;
[1398] Fix | Delete
var targetWidth = targetSize.width;
[1399] Fix | Delete
[1400] Fix | Delete
var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
[1401] Fix | Delete
[1402] Fix | Delete
this.options.constraints.forEach(function (constraint) {
[1403] Fix | Delete
var outOfBoundsClass = constraint.outOfBoundsClass;
[1404] Fix | Delete
var pinnedClass = constraint.pinnedClass;
[1405] Fix | Delete
[1406] Fix | Delete
if (outOfBoundsClass) {
[1407] Fix | Delete
allClasses.push(outOfBoundsClass);
[1408] Fix | Delete
}
[1409] Fix | Delete
if (pinnedClass) {
[1410] Fix | Delete
allClasses.push(pinnedClass);
[1411] Fix | Delete
}
[1412] Fix | Delete
});
[1413] Fix | Delete
[1414] Fix | Delete
allClasses.forEach(function (cls) {
[1415] Fix | Delete
['left', 'top', 'right', 'bottom'].forEach(function (side) {
[1416] Fix | Delete
allClasses.push(cls + '-' + side);
[1417] Fix | Delete
});
[1418] Fix | Delete
});
[1419] Fix | Delete
[1420] Fix | Delete
var addClasses = [];
[1421] Fix | Delete
[1422] Fix | Delete
var tAttachment = extend({}, targetAttachment);
[1423] Fix | Delete
var eAttachment = extend({}, this.attachment);
[1424] Fix | Delete
[1425] Fix | Delete
this.options.constraints.forEach(function (constraint) {
[1426] Fix | Delete
var to = constraint.to;
[1427] Fix | Delete
var attachment = constraint.attachment;
[1428] Fix | Delete
var pin = constraint.pin;
[1429] Fix | Delete
[1430] Fix | Delete
if (typeof attachment === 'undefined') {
[1431] Fix | Delete
attachment = '';
[1432] Fix | Delete
}
[1433] Fix | Delete
[1434] Fix | Delete
var changeAttachX = undefined,
[1435] Fix | Delete
changeAttachY = undefined;
[1436] Fix | Delete
if (attachment.indexOf(' ') >= 0) {
[1437] Fix | Delete
var _attachment$split = attachment.split(' ');
[1438] Fix | Delete
[1439] Fix | Delete
var _attachment$split2 = _slicedToArray(_attachment$split, 2);
[1440] Fix | Delete
[1441] Fix | Delete
changeAttachY = _attachment$split2[0];
[1442] Fix | Delete
changeAttachX = _attachment$split2[1];
[1443] Fix | Delete
} else {
[1444] Fix | Delete
changeAttachX = changeAttachY = attachment;
[1445] Fix | Delete
}
[1446] Fix | Delete
[1447] Fix | Delete
var bounds = getBoundingRect(_this, to);
[1448] Fix | Delete
[1449] Fix | Delete
if (changeAttachY === 'target' || changeAttachY === 'both') {
[1450] Fix | Delete
if (top < bounds[1] && tAttachment.top === 'top') {
[1451] Fix | Delete
top += targetHeight;
[1452] Fix | Delete
tAttachment.top = 'bottom';
[1453] Fix | Delete
}
[1454] Fix | Delete
[1455] Fix | Delete
if (top + height > bounds[3] && tAttachment.top === 'bottom') {
[1456] Fix | Delete
top -= targetHeight;
[1457] Fix | Delete
tAttachment.top = 'top';
[1458] Fix | Delete
}
[1459] Fix | Delete
}
[1460] Fix | Delete
[1461] Fix | Delete
if (changeAttachY === 'together') {
[1462] Fix | Delete
if (tAttachment.top === 'top') {
[1463] Fix | Delete
if (eAttachment.top === 'bottom' && top < bounds[1]) {
[1464] Fix | Delete
top += targetHeight;
[1465] Fix | Delete
tAttachment.top = 'bottom';
[1466] Fix | Delete
[1467] Fix | Delete
top += height;
[1468] Fix | Delete
eAttachment.top = 'top';
[1469] Fix | Delete
} else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
[1470] Fix | Delete
top -= height - targetHeight;
[1471] Fix | Delete
tAttachment.top = 'bottom';
[1472] Fix | Delete
[1473] Fix | Delete
eAttachment.top = 'bottom';
[1474] Fix | Delete
}
[1475] Fix | Delete
}
[1476] Fix | Delete
[1477] Fix | Delete
if (tAttachment.top === 'bottom') {
[1478] Fix | Delete
if (eAttachment.top === 'top' && top + height > bounds[3]) {
[1479] Fix | Delete
top -= targetHeight;
[1480] Fix | Delete
tAttachment.top = 'top';
[1481] Fix | Delete
[1482] Fix | Delete
top -= height;
[1483] Fix | Delete
eAttachment.top = 'bottom';
[1484] Fix | Delete
} else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
[1485] Fix | Delete
top += height - targetHeight;
[1486] Fix | Delete
tAttachment.top = 'top';
[1487] Fix | Delete
[1488] Fix | Delete
eAttachment.top = 'top';
[1489] Fix | Delete
}
[1490] Fix | Delete
}
[1491] Fix | Delete
[1492] Fix | Delete
if (tAttachment.top === 'middle') {
[1493] Fix | Delete
if (top + height > bounds[3] && eAttachment.top === 'top') {
[1494] Fix | Delete
top -= height;
[1495] Fix | Delete
eAttachment.top = 'bottom';
[1496] Fix | Delete
} else if (top < bounds[1] && eAttachment.top === 'bottom') {
[1497] Fix | Delete
top += height;
[1498] Fix | Delete
eAttachment.top = 'top';
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function