MCPcopy Create free account
hub / github.com/microsoft/SandDance / getSelectedColorMap

Function getSelectedColorMap

docs/app/js/sanddance-app.js:10404–10426  ·  view source on GitHub ↗
(currentData, showSelectedData, showActive, viewerOptions)

Source from the content-addressed store, hash-verified

10402var _sanddanceSpecs = require("@msrvida/sanddance-specs");
10403var _constants = require("./constants");
10404function getSelectedColorMap(currentData, showSelectedData, showActive, viewerOptions) {
10405 function getSelectionColorItem(datum) {
10406 let item;
10407 if (showSelectedData) item = datum[(0, _sanddanceSpecs.FieldNames).Selected] ? {
10408 color: _vegaDeckGl.util.colorFromString(viewerOptions.colors.selectedCube)
10409 } : {
10410 unSelected: true
10411 };
10412 if (showActive && datum[(0, _sanddanceSpecs.FieldNames).Active]) item = {
10413 color: _vegaDeckGl.util.colorFromString(viewerOptions.colors.activeCube)
10414 };
10415 return item;
10416 }
10417 const colorMap = {};
10418 currentData.forEach((datum)=>{
10419 const selectionColor = getSelectionColorItem(datum);
10420 if (selectionColor) {
10421 const ordinal = datum[0, _constants.GL_ORDINAL];
10422 colorMap[ordinal] = selectionColor;
10423 }
10424 });
10425 return colorMap;
10426}
10427function colorMapFromCubes(cubes) {
10428 const map = {};
10429 cubes.forEach((cube)=>{

Callers

nothing calls this directly

Calls 2

getSelectionColorItemFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected