MCPcopy Index your code
hub / github.com/microsoft/SandDance / facetSelectionPolygons

Function facetSelectionPolygons

docs/app/js/sanddance-app.js:10208–10243  ·  view source on GitHub ↗
(facetRects)

Source from the content-addressed store, hash-verified

10206 return polygons;
10207}
10208function facetSelectionPolygons(facetRects) {
10209 const polygons = [];
10210 const linesAndSearches = facetRects.map(({ datum , lines }, i)=>{
10211 let group = (0, _search.getSearchGroupFromVegaValue)(datum[(0, _sanddanceSpecs.FieldNames).FacetSearch]);
10212 return {
10213 lines,
10214 search: group
10215 };
10216 });
10217 linesAndSearches.forEach(({ lines , search }, i)=>{
10218 //take any 2 lines to get a box dimension
10219 const [x, y] = minMaxPoints(lines.slice(2));
10220 polygons.push({
10221 search,
10222 polygon: [
10223 [
10224 x.min,
10225 y.min
10226 ],
10227 [
10228 x.max,
10229 y.min
10230 ],
10231 [
10232 x.max,
10233 y.max
10234 ],
10235 [
10236 x.min,
10237 y.max
10238 ]
10239 ]
10240 });
10241 });
10242 return polygons;
10243}
10244function minMaxPoints(lines) {
10245 const points = [];
10246 lines.forEach((line)=>{

Callers 1

axisSelectionLayerFunction · 0.70

Calls 2

minMaxPointsFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected