allen-cell-animated / website-3d-cell-viewer

Other
5 stars 5 forks source link

feat: Save control point info to URL #297

Closed ShrimpCryptid closed 1 month ago

ShrimpCryptid commented 1 month ago

Closes #282, saving the control points to the URL!

Estimated review size: large, 30 minutes

This change adds the following properties to the URL:

controlPoints - 'cps'
controlPointsEnabled - 'cpe'
ramp - 'rmp'

(^ I'm open to feedback on any of these abbreviations)

These capture the current control point and ramp information, as well as whether the control points OR ramp should be visible in the UI (now shown under the 'Advanced' checkbox in the volume settings editor).

Note that rmp is slightly redundant with the existing lut field in the URL; I elected to keep them separate as we expect lut to be a user input property, while the ramp and controlPoints are only used when capturing existing state from the user interacting with the viewer.

Changes

Validation

image

ShrimpCryptid commented 1 month ago

The comments are helpful! and the logic of serialization and deserialization for cps, cpe and rmp makes sense

Thank you, glad to hear it!