Skip to content

Commit

Permalink
Convert current style to autoRange format before saving preset
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Dec 8, 2023
1 parent 2701d45 commit 48e8547
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default {
name: this.newPresetName || this.generatedPresetName,
mode: this.currentMode,
frame: this.currentFrame,
style: this.currentStyle
style: {bands: this.currentStyle.bands.map((b) => this.styleToAutoRange(b))}
};
newPreset.name = newPreset.name.trim();
if (!overwrite && this.availablePresets.find((p) => p.name === newPreset.name)) {
Expand Down Expand Up @@ -153,6 +153,15 @@ export default {
contentType: 'application/json'
});
},
styleToAutoRange(band) {
band = Object.assign({}, band); // new reference
if (band.min && band.min.includes('min:')) {
band.autoRange = parseFloat(band.min.replace('min:', '')) * 100;
delete band.min;
delete band.max;
}
return band;
},
styleFromAutoRange(band) {
band = Object.assign({}, band); // new reference
if (band.autoRange) {
Expand Down

0 comments on commit 48e8547

Please sign in to comment.