Skip to content

Commit 3341e85

Browse files
authored
Merge pull request #285 from DigitalSlideArchive/fix-radio-selection
Don't change the color radio button needlessly.
2 parents b3f8361 + 62bddef commit 3341e85

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

histomicsui/web_client/dialogs/saveAnnotation.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ var SaveAnnotation = View.extend({
216216
'click .h-access': 'access',
217217
'click .h-cancel': 'cancel',
218218

219-
'input #h-annotation-fill-color': () => $('.h-functional-value #h-annotation-fill-color-fixed').prop('checked', true),
220-
'changeColor #h-annotation-colorpicker-fill-color': () => $('.h-functional-value #h-annotation-fill-color-fixed').prop('checked', true),
219+
'input #h-annotation-fill-color': 'checkFixedIfPresent',
220+
'changeColor #h-annotation-colorpicker-fill-color': 'checkFixedIfPresent',
221221
'change #h-annotation-fill-color-func-list': 'changeFillColorFunc',
222222
'input #h-annotation-fill-color-min-val': () => $('.h-functional-value #h-annotation-fill-color-min-setval').prop('checked', true),
223223
'input #h-annotation-fill-color-max-val': () => $('.h-functional-value #h-annotation-fill-color-max-setval').prop('checked', true),
224224

225-
'input #h-annotation-line-color': () => $('.h-functional-value #h-annotation-line-color-fixed').prop('checked', true),
226-
'changeColor #h-annotation-colorpicker-line-color': () => $('.h-functional-value #h-annotation-line-color-fixed').prop('checked', true),
225+
'input #h-annotation-line-color': 'checkFixedIfPresent',
226+
'changeColor #h-annotation-colorpicker-line-color': 'checkFixedIfPresent',
227227
'change #h-annotation-line-color-func-list': 'changeLineColorFunc',
228228
'input #h-annotation-line-color-min-val': () => $('.h-functional-value #h-annotation-line-color-min-setval').prop('checked', true),
229229
'input #h-annotation-line-color-max-val': () => $('.h-functional-value #h-annotation-line-color-max-setval').prop('checked', true),
@@ -369,6 +369,13 @@ var SaveAnnotation = View.extend({
369369
this._updateFuncValues();
370370
},
371371

372+
checkFixedIfPresent(evt) {
373+
let val = $(evt.target).closest('.row').find('input[type="text"]').val();
374+
if ((val || '').trim().length) {
375+
$(evt.target).closest('.row').find('input[type="radio"]').prop('checked', true);
376+
}
377+
},
378+
372379
_updateFuncValues() {
373380
var names = ['fill-color', 'line-color'];
374381
names.forEach((name) => {

0 commit comments

Comments
 (0)