You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
485 B
28 lines
485 B
import noop from "../noop"; |
|
|
|
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;
|
|
|