Refactor reverse ramp control into ColorRampControls component#1139
Refactor reverse ramp control into ColorRampControls component#1139nakul-py wants to merge 1 commit intogeojupyter:mainfrom
Conversation
|
Tests are failing 😣. Why? |
|
Looks like an outage or degraded service on anaconda.org: |
|
No incidents logged: https://anaconda.statuspage.io/ |
|
Integration tests report: appsharing.space |
Now all the checks are passed automatically. |
|
I'll try and review this in an hour or so! |
| const ramp = colorMaps.filter(c => c.name === rampName); | ||
|
|
||
| canvas.width = canvasWidth; | ||
| canvas.height = canvasHeight; | ||
|
|
||
| for (let i = 0; i <= 255; i++) { | ||
| ctx.beginPath(); | ||
|
|
||
| const color = ramp[0].colors[i]; | ||
| const color = reverse ? ramp[0].colors[255 - i] : ramp[0].colors[i]; |
There was a problem hiding this comment.
What do you think of reversing the ramp as early as possible? I'd like to eliminate the magic number 255 as much as possible :)
| const color = reverse ? ramp[0].colors[255 - i] : ramp[0].colors[i]; | |
| const ramp = colorMaps.filter(c => c.name === rampName)[0]; | |
| const colors = reverse ? ramp.colors.reverse() : ramp.colors; | |
| canvas.width = canvasWidth; | |
| canvas.height = canvasHeight; | |
| for (let i = 0; i <= 255; i++) { | |
| ctx.beginPath(); | |
| const color = colors[i]; |
There was a problem hiding this comment.
Or maybe something like this is better?
const ramp = colorMaps.filter(c => c.name === rampName)[0];
if (reverse) {
ramp.colors = ramp.colors.reverse();
}This way we only have one source of truth for the colors we'll be using instead of creating a copy?
| flex: 0 1 auto; | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: 0.4rem; |
There was a problem hiding this comment.
I'm curious why we need a CSS change for this refactor? I have to jump to a meeting really soon so I didn't have time to check out what this CSS change does :)
Description
Now ColorRampControls is the final source of truth for Reverse ramp working.
Screencast.From.2026-02-25.21-12-36.mp4
Checklist
Resolves #XXX.Failing lint checks can be resolved with:
pre-commit run --all-filesjlpm run lintCITATION.cffcontains an author entry for yourself📚 Documentation preview: https://jupytergis--1139.org.readthedocs.build/en/1139/
💡 JupyterLite preview: https://jupytergis--1139.org.readthedocs.build/en/1139/lite
💡 Specta preview: https://jupytergis--1139.org.readthedocs.build/en/1139/lite/specta