|
Last change
on this file since ba17441 was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
488 bytes
|
| Line | |
|---|
| 1 | import noop from "../noop.js";
|
|---|
| 2 |
|
|---|
| 3 | var x0 = Infinity,
|
|---|
| 4 | y0 = x0,
|
|---|
| 5 | x1 = -x0,
|
|---|
| 6 | y1 = x1;
|
|---|
| 7 |
|
|---|
| 8 | var boundsStream = {
|
|---|
| 9 | point: boundsPoint,
|
|---|
| 10 | lineStart: noop,
|
|---|
| 11 | lineEnd: noop,
|
|---|
| 12 | polygonStart: noop,
|
|---|
| 13 | polygonEnd: noop,
|
|---|
| 14 | result: function() {
|
|---|
| 15 | var bounds = [[x0, y0], [x1, y1]];
|
|---|
| 16 | x1 = y1 = -(y0 = x0 = Infinity);
|
|---|
| 17 | return bounds;
|
|---|
| 18 | }
|
|---|
| 19 | };
|
|---|
| 20 |
|
|---|
| 21 | function boundsPoint(x, y) {
|
|---|
| 22 | if (x < x0) x0 = x;
|
|---|
| 23 | if (x > x1) x1 = x;
|
|---|
| 24 | if (y < y0) y0 = y;
|
|---|
| 25 | if (y > y1) y1 = y;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | export default boundsStream;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.