Skip to content

Commit 1408055

Browse files
committed
hilo mode with maximum one channel active
1 parent b477928 commit 1408055

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/js/models/panel_model.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@
457457
// labels_map is {labelKey: {size:s, text:t, position:p, color:c}} or {labelKey: false} to delete
458458
// where labelKey specifies the label to edit. "l.text + '_' + l.size + '_' + l.color + '_' + l.position"
459459
edit_labels: function(labels_map) {
460-
460+
461461
var oldLabs = this.get('labels');
462462
// Need to clone the list of labels...
463463
var labs = [],
@@ -483,7 +483,7 @@
483483
// Extract all the keys (even duplicates)
484484
var keys = labs.map(lbl => this.get_label_key(lbl));
485485

486-
// get all unique labels based on filtering keys
486+
// get all unique labels based on filtering keys
487487
//(i.e removing duplicate keys based on the index of the first occurrence of the value)
488488
var filtered_lbls = labs.filter((lbl, index) => index == keys.indexOf(this.get_label_key(lbl)));
489489

@@ -515,12 +515,19 @@
515515
this.save('channels', chs);
516516
},
517517

518-
toggle_channel: function(cIndex, active ) {
519-
518+
toggle_channel: function(cIndex, active) {
520519
if (typeof active == "undefined") {
521520
active = !this.get('channels')[cIndex].active;
522521
}
523-
this.save_channel(cIndex, 'active', active);
522+
523+
if (this.get("hilo_enabled") && active) {
524+
let newChs = this.get('channels').map(function(channel, idx) {
525+
return {'active': idx == cIndex};
526+
});
527+
this.save_channels(newChs);
528+
} else {
529+
this.save_channel(cIndex, 'active', active);
530+
}
524531
},
525532

526533
save_channel_window: function(cIndex, new_w) {

src/js/views/channel_slider_view.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,16 @@ var ChannelSliderView = Backbone.View.extend({
281281
return channel.color;
282282
})
283283
});
284+
let foundActive = false;
284285
let newChs = m.get('channels').map(function(channel, idx) {
285-
return {'color': 'hilo.lut'};
286+
// Switch LUT to HiLo for all channels
287+
// Keep only the first active channel active
288+
let new_state = {
289+
'color': 'hilo.lut',
290+
'active': (!foundActive && channel.active)
291+
}
292+
foundActive = (foundActive || channel.active);
293+
return new_state;
286294
});
287295
m.save_channels(newChs);
288296
} else if (!checkboxState && m.get("hilo_enabled")){

0 commit comments

Comments
 (0)