(pt, ref, size)
| 67 | }; |
| 68 | |
| 69 | var findClosestEdge = function(pt, ref, size) { |
| 70 | var e = trace.tiling.pad; |
| 71 | var isLeftOfRect = function(x) { return x - e <= ref.x0; }; |
| 72 | var isRightOfRect = function(x) { return x + e >= ref.x1; }; |
| 73 | var isBottomOfRect = function(y) { return y - e <= ref.y0; }; |
| 74 | var isTopOfRect = function(y) { return y + e >= ref.y1; }; |
| 75 | |
| 76 | if(pt.x0 === ref.x0 && pt.x1 === ref.x1 && pt.y0 === ref.y0 && pt.y1 === ref.y1) { |
| 77 | return { |
| 78 | x0: pt.x0, |
| 79 | x1: pt.x1, |
| 80 | y0: pt.y0, |
| 81 | y1: pt.y1 |
| 82 | }; |
| 83 | } |
| 84 | |
| 85 | return { |
| 86 | x0: isLeftOfRect(pt.x0 - e) ? 0 : isRightOfRect(pt.x0 - e) ? size[0] : pt.x0, |
| 87 | x1: isLeftOfRect(pt.x1 + e) ? 0 : isRightOfRect(pt.x1 + e) ? size[0] : pt.x1, |
| 88 | y0: isBottomOfRect(pt.y0 - e) ? 0 : isTopOfRect(pt.y0 - e) ? size[1] : pt.y0, |
| 89 | y1: isBottomOfRect(pt.y1 + e) ? 0 : isTopOfRect(pt.y1 + e) ? size[1] : pt.y1 |
| 90 | }; |
| 91 | }; |
| 92 | |
| 93 | // stash of 'previous' position data used by tweening functions |
| 94 | var prevEntry = null; |
no test coverage detected
searching dependent graphs…