MCPcopy
hub / github.com/microsoft/SandDance / applyColorMapToCubes

Function applyColorMapToCubes

packages/sanddance/src/colorCubes.ts:56–75  ·  view source on GitHub ↗
(maps: ColorMap[], cubes: VegaDeckGl.types.Cube[], unselectedColorMethod?: ColorMethod)

Source from the content-addressed store, hash-verified

54}
55
56export function applyColorMapToCubes(maps: ColorMap[], cubes: VegaDeckGl.types.Cube[], unselectedColorMethod?: ColorMethod) {
57 Object.keys(maps[0]).forEach(ordinal => {
58 const cube = cubes[+ordinal];
59 if (cube && !cube.isEmpty) {
60 const actualColorMappedItem: ColorMappedItem = maps[0][ordinal];
61 if (maps.length > 1) {
62 const selectedColorMappedItem: ColorMappedItem = maps[1][ordinal];
63 if (selectedColorMappedItem) {
64 if (selectedColorMappedItem.unSelected && unselectedColorMethod) {
65 cube.color = unselectedColorMethod(actualColorMappedItem.color);
66 } else {
67 cube.color = selectedColorMappedItem.color;
68 }
69 return;
70 }
71 }
72 cube.color = actualColorMappedItem.color;
73 }
74 });
75}

Callers 4

onAnimateDataChangeMethod · 0.90
onDataChangedMethod · 0.90
renderSameLayoutMethod · 0.90
_renderMethod · 0.90

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected