From 48e8547f6a80b71e28dd72090d0a5b9ff0ec4e2e Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Fri, 8 Dec 2023 16:45:28 -0500 Subject: [PATCH] Convert current style to autoRange format before saving preset --- .../web_client/vue/components/PresetsMenu.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/girder/girder_large_image/web_client/vue/components/PresetsMenu.vue b/girder/girder_large_image/web_client/vue/components/PresetsMenu.vue index 3ba7f84d3..d363c858f 100644 --- a/girder/girder_large_image/web_client/vue/components/PresetsMenu.vue +++ b/girder/girder_large_image/web_client/vue/components/PresetsMenu.vue @@ -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)) { @@ -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) {