simularium / simularium-viewer

NPM package to view Simularium trajectories in 3D
Apache License 2.0
2 stars 0 forks source link

Feature/color module #352

Closed meganrm closed 9 months ago

meganrm commented 9 months ago

Problem

347

Solution

I moved all the functions in visGeometry into a colorHandling class. In the process I also simplified the colorChanges which was an array, but we're only ever sending in one colorChange at a time. I updated https://github.com/simularium/simularium-website/pull/432 for this change too.

VisGeometry still has some color handling functions to unite the color with the visAgent, but it now only deals with colors by their names (no indices).

Type of change

Please delete options that are not relevant.

Steps to Verify:

  1. npm start
  2. change an agent color using the drop downs.
github-actions[bot] commented 9 months ago

jest coverage report ๐Ÿงช

Total coverage

Status Category Percentage Covered / Total
๐Ÿ”ด Statements 40.73% (-5.13% ๐Ÿ”ป) 1997/4902
๐Ÿ”ด Branches 44.26% 829/1873
๐Ÿ”ด Functions 37.79% (-5.69% ๐Ÿ”ป) 412/1090
๐Ÿ”ด Lines 40.94% (-4.91% ๐Ÿ”ป) 1911/4667

Status of coverage: ๐ŸŸข - ok, ๐ŸŸก - slightly more than threshold, ๐Ÿ”ด - under the threshold

Show new covered files ๐ŸŒ‘ ### Coverage of new files | Status | Filename | Statements | Branches | Functions | Lines | | :----: | :-------------- | :--------- | :------- | :-------- | :------ | | ๐ŸŸก | ColorHandler.ts | 67.64% | 75% | 62.06% | 66.66% | > Status of coverage: ๐ŸŸข - ok, ๐ŸŸก - slightly more than threshold, ๐Ÿ”ด - under the threshold
Show files with reduced coverage ๐Ÿ”ป ### Reduced coverage | Status | Filename | Statements | Branches | Functions | Lines | | :----: | :------------------------ | :------------------ | :----------------- | :------------------ | :------------------ | | ๐ŸŸก | src | 77.98% (-1.83% ๐Ÿ”ป) | 69.09% | 50% (-5.26% ๐Ÿ”ป) | 78.43% (-1.96% ๐Ÿ”ป) | | ๐ŸŸข | constants.ts | 82.35% (-11.76% ๐Ÿ”ป) | 100% | 57.14% (-28.57% ๐Ÿ”ป) | 81.25% (-12.5% ๐Ÿ”ป) | | ๐Ÿ”ด | index.ts | 7.82% (-18.32% ๐Ÿ”ป) | 7.56% (-4.74% ๐Ÿ”ป) | 5.83% (-13.71% ๐Ÿ”ป) | 7.79% (-18.3% ๐Ÿ”ป) | | ๐ŸŸก | src/simularium | 62.47% | 60.17% | 51.73% | 63.37% | | ๐ŸŸข | SelectionInterface.ts | 95% | 86.04% | 95.23% | 95.48% | | ๐Ÿ”ด | src/visGeometry | 21.98% (-8.01% ๐Ÿ”ป) | 23.2% | 28.03% (-4.27% ๐Ÿ”ป) | 21.86% (-8.23% ๐Ÿ”ป) | | ๐Ÿ”ด | GeometryStore.ts | 50.51% | 37.37% (-1.01% ๐Ÿ”ป) | 63.41% | 49.73% | | ๐Ÿ”ด | src/visGeometry/rendering | 40.97% (-10% ๐Ÿ”ป) | 65.27% (-1.23% ๐Ÿ”ป) | 32.23% (-17.58% ๐Ÿ”ป) | 41.49% (-8.94% ๐Ÿ”ป) | | ๐ŸŸก | CompositePass.ts | 60% (-17.5% ๐Ÿ”ป) | 75% (-5% ๐Ÿ”ป) | 25% (-37.5% ๐Ÿ”ป) | 62.16% (-13.51% ๐Ÿ”ป) | | ๐ŸŸก | ContourPass.ts | 58.53% (-9.76% ๐Ÿ”ป) | 83.33% | 23.52% (-23.53% ๐Ÿ”ป) | 60.52% (-5.26% ๐Ÿ”ป) | | ๐ŸŸก | DrawBufferPass.ts | 66.66% (-11.11% ๐Ÿ”ป) | 83.33% | 33.33% (-33.33% ๐Ÿ”ป) | 69.69% (-6.06% ๐Ÿ”ป) | | ๐Ÿ”ด | GBufferPass.ts | 40% (-12.3% ๐Ÿ”ป) | 75% | 36.36% (-36.36% ๐Ÿ”ป) | 41.66% (-10% ๐Ÿ”ป) | | ๐Ÿ”ด | GaussianBlur.ts | 34.28% (-40% ๐Ÿ”ป) | 68.18% (-9.09% ๐Ÿ”ป) | 22.22% (-50% ๐Ÿ”ป) | 35.38% (-36.92% ๐Ÿ”ป) | | ๐Ÿ”ด | HitTestHelper.ts | 55% (-22.5% ๐Ÿ”ป) | 77.77% | 44.44% (-33.33% ๐Ÿ”ป) | 56.75% (-21.62% ๐Ÿ”ป) | | ๐Ÿ”ด | InstancedFiber.ts | 17.04% (-2.27% ๐Ÿ”ป) | 56% | 14.28% (-5.72% ๐Ÿ”ป) | 16.56% (-2.37% ๐Ÿ”ป) | | ๐Ÿ”ด | LegacyRenderer.ts | 25.25% (-5.05% ๐Ÿ”ป) | 33.33% | 29.41% (-11.76% ๐Ÿ”ป) | 24.46% (-5.32% ๐Ÿ”ป) | | ๐ŸŸข | PDBGBufferShaders.ts | 93.33% (-3.33% ๐Ÿ”ป) | 77.77% | 71.42% (-14.29% ๐Ÿ”ป) | 96.29% (-3.71% ๐Ÿ”ป) | | ๐ŸŸก | RenderToBuffer.ts | 63.88% (-27.78% ๐Ÿ”ป) | 70% (-10% ๐Ÿ”ป) | 44.44% (-33.33% ๐Ÿ”ป) | 66.66% (-27.27% ๐Ÿ”ป) | | ๐ŸŸก | SSAO.ts | 66.66% (-11.11% ๐Ÿ”ป) | 83.33% | 40% (-40% ๐Ÿ”ป) | 69.69% (-6.06% ๐Ÿ”ป) | | ๐Ÿ”ด | SimulariumRenderer.ts | 22.75% (-26.9% ๐Ÿ”ป) | 75% | 15.38% (-23.08% ๐Ÿ”ป) | 22.85% (-25% ๐Ÿ”ป) | > Status of coverage: ๐ŸŸข - ok, ๐ŸŸก - slightly more than threshold, ๐Ÿ”ด - under the threshold
toloudis commented 9 months ago

About the change to only accept a single color at a time, I think we used to have in mind bulk color changes like "palettes". That's the only reason I can remember ever needing to change multiple colors in one function call in an optimized way. (And of course we never did it)

meganrm commented 9 months ago

About the change to only accept a single color at a time, I think we used to have in mind bulk color changes like "palettes". That's the only reason I can remember ever needing to change multiple colors in one function call in an optimized way. (And of course we never did it)

Yeah, I think in that case we would wipe everything out, ie, re-init the colorHandler with the new pallet, and then just call 'setInitialColors' again.