nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
664 stars 169 forks source link

Don't mutate colorDomain in place when colorReverse is true #904

Closed fredludlow closed 2 years ago

fredludlow commented 2 years ago

Very small change. Previously, if colorDomain and colorReverse were set, the colorDomain array would be reversed in place (in the colormaker's scale creation step). If the representation requires multiple instances of colormaker (e.g. ball+stick) then theeven numbered ones appear with the color reversed:

https://codepen.io/fludlow/pen/KKXjRwY

This fix copies the array before reversing it (so the original one isn't mutated)