(gd, groups, xaHash, yaHash, exclude)
| 1244 | } |
| 1245 | |
| 1246 | function calcLinks(gd, groups, xaHash, yaHash, exclude) { |
| 1247 | var isSubplotConstrained = false; |
| 1248 | var xLinks = {}; |
| 1249 | var yLinks = {}; |
| 1250 | var xID, yID, xLinkID, yLinkID; |
| 1251 | var xExclude = (exclude || {}).xaHash; |
| 1252 | var yExclude = (exclude || {}).yaHash; |
| 1253 | |
| 1254 | for(var i = 0; i < groups.length; i++) { |
| 1255 | var group = groups[i]; |
| 1256 | // check if any of the x axes we're dragging is in this constraint group |
| 1257 | for(xID in xaHash) { |
| 1258 | if(group[xID]) { |
| 1259 | // put the rest of these axes into xLinks, if we're not already |
| 1260 | // dragging them, so we know to scale these axes automatically too |
| 1261 | // to match the changes in the dragged x axes |
| 1262 | for(xLinkID in group) { |
| 1263 | if( |
| 1264 | !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && |
| 1265 | !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] |
| 1266 | ) { |
| 1267 | xLinks[xLinkID] = xID; |
| 1268 | } |
| 1269 | } |
| 1270 | |
| 1271 | // check if the x and y axes of THIS drag are linked |
| 1272 | for(yID in yaHash) { |
| 1273 | if( |
| 1274 | !(exclude && (xExclude[yID] || yExclude[yID])) && |
| 1275 | group[yID] |
| 1276 | ) { |
| 1277 | isSubplotConstrained = true; |
| 1278 | } |
| 1279 | } |
| 1280 | } |
| 1281 | } |
| 1282 | |
| 1283 | // now check if any of the y axes we're dragging is in this constraint group |
| 1284 | // only look for outside links, as we've already checked for links within the dragger |
| 1285 | for(yID in yaHash) { |
| 1286 | if(group[yID]) { |
| 1287 | for(yLinkID in group) { |
| 1288 | if( |
| 1289 | !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && |
| 1290 | !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] |
| 1291 | ) { |
| 1292 | yLinks[yLinkID] = yID; |
| 1293 | } |
| 1294 | } |
| 1295 | } |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | if(isSubplotConstrained) { |
| 1300 | // merge xLinks and yLinks if the subplot is constrained, |
| 1301 | // since we'll always apply both anyway and the two will contain |
| 1302 | // duplicates |
| 1303 | Lib.extendFlat(xLinks, yLinks); |
no outgoing calls
no test coverage detected
searching dependent graphs…