| import noop from "../noop.js"; | |
| var x0 = Infinity, | |
| y0 = x0, | |
| x1 = -x0, | |
| y1 = x1; | |
| var boundsStream = { | |
| point: boundsPoint, | |
| lineStart: noop, | |
| lineEnd: noop, | |
| polygonStart: noop, | |
| polygonEnd: noop, | |
| result: function() { | |
| var bounds = [[x0, y0], [x1, y1]]; | |
| x1 = y1 = -(y0 = x0 = Infinity); | |
| return bounds; | |
| } | |
| }; | |
| function boundsPoint(x, y) { | |
| if (x < x0) x0 = x; | |
| if (x > x1) x1 = x; | |
| if (y < y0) y0 = y; | |
| if (y > y1) y1 = y; | |
| } | |
| export default boundsStream; | |