(facetRects: VegaDeckGl.types.FacetRect[])
| 111 | } |
| 112 | |
| 113 | function facetSelectionPolygons(facetRects: VegaDeckGl.types.FacetRect[]) { |
| 114 | const polygons: SelectPolygon[] = []; |
| 115 | const linesAndSearches: { lines: VegaDeckGl.types.StyledLine[], search: SearchExpressionGroup }[] = facetRects.map(({ datum, lines }, i) => { |
| 116 | const group: SearchExpressionGroup = getSearchGroupFromVegaValue(datum[FieldNames.FacetSearch]); |
| 117 | return { |
| 118 | lines, |
| 119 | search: group, |
| 120 | }; |
| 121 | }); |
| 122 | linesAndSearches.forEach(({ lines, search }, i) => { |
| 123 | //take any 2 lines to get a box dimension |
| 124 | const [x, y] = minMaxPoints(lines.slice(2)); |
| 125 | polygons.push({ |
| 126 | search, |
| 127 | polygon: [[x.min, y.min], [x.max, y.min], [x.max, y.max], [x.min, y.max]], |
| 128 | }); |
| 129 | }); |
| 130 | return polygons; |
| 131 | } |
| 132 | |
| 133 | function minMaxPoints(lines: VegaDeckGl.types.StyledLine[]) { |
| 134 | const points: number[][] = []; |
no test coverage detected