Mangara / Color-Zebra

Beautiful sequential colormaps.
MIT License
0 stars 0 forks source link

The site JS crashes for specific page widths #16

Closed Mangara closed 6 years ago

Mangara commented 6 years ago

For certain page widths, the values for the last column of the test image can be just above 1:

Preview.js:57 width: 1467 x: 1466 y: 10 val: 1.0000000000000169
...
Preview.js:57 width: 1467 x: 1466 y: 1 val: 1.0000000000000187

This causes the color to be null, which causes an uncaught TypeError in ColorZebra.Color.LABtoXYZ, so the remainder of the page JS does not execute.

The easy fix is to clamp color values in ColorZebra.ColorMap.normalizeLightness. But the computation for the test image is most likely slightly wrong, which should be corrected as well.

Mangara commented 6 years ago

These width values include 1251, which happens to be the width in a new profile Firefox window.