(x, y)
| 30 | // Instead of using mixins we use free functions for now |
| 31 | |
| 32 | function point_selector(x, y) { |
| 33 | return function (xar, yar) { |
| 34 | if (typeof yar === 'undefined') { |
| 35 | // the 'old' method for backwards compatibility |
| 36 | return sel_utils.point_in_rectangle(xar, x, y); |
| 37 | } |
| 38 | |
| 39 | const len = Math.min(xar.length, yar.length); |
| 40 | const mask = new Uint8Array(len); |
| 41 | // for performance we keep the if statement out of the loop |
| 42 | if (x.length && y.length) { |
| 43 | for (let i = 0; i < len; i++) { |
| 44 | mask[i] = |
| 45 | x[0] <= xar[i] && xar[i] <= x[1] && y[0] <= yar[i] && yar[i] <= y[1] |
| 46 | ? 1 |
| 47 | : 0; |
| 48 | } |
| 49 | return mask; |
| 50 | } else if (x.length) { |
| 51 | for (let i = 0; i < len; i++) { |
| 52 | mask[i] = x[0] <= xar[i] && xar[i] <= x[1] ? 1 : 0; |
| 53 | } |
| 54 | } else { |
| 55 | // (y.length) |
| 56 | for (let i = 0; i < len; i++) { |
| 57 | mask[i] = y[0] <= yar[i] && yar[i] <= y[1] ? 1 : 0; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | return mask; |
| 62 | }; |
| 63 | } |
| 64 | |
| 65 | function rect_selector(x, y) { |
| 66 | return function (xy) { |
no outgoing calls
no test coverage detected
searching dependent graphs…