|
457 | 457 | // labels_map is {labelKey: {size:s, text:t, position:p, color:c}} or {labelKey: false} to delete
|
458 | 458 | // where labelKey specifies the label to edit. "l.text + '_' + l.size + '_' + l.color + '_' + l.position"
|
459 | 459 | edit_labels: function(labels_map) {
|
460 |
| - |
| 460 | + |
461 | 461 | var oldLabs = this.get('labels');
|
462 | 462 | // Need to clone the list of labels...
|
463 | 463 | var labs = [],
|
|
483 | 483 | // Extract all the keys (even duplicates)
|
484 | 484 | var keys = labs.map(lbl => this.get_label_key(lbl));
|
485 | 485 |
|
486 |
| - // get all unique labels based on filtering keys |
| 486 | + // get all unique labels based on filtering keys |
487 | 487 | //(i.e removing duplicate keys based on the index of the first occurrence of the value)
|
488 | 488 | var filtered_lbls = labs.filter((lbl, index) => index == keys.indexOf(this.get_label_key(lbl)));
|
489 | 489 |
|
|
515 | 515 | this.save('channels', chs);
|
516 | 516 | },
|
517 | 517 |
|
518 |
| - toggle_channel: function(cIndex, active ) { |
519 |
| - |
| 518 | + toggle_channel: function(cIndex, active) { |
520 | 519 | if (typeof active == "undefined") {
|
521 | 520 | active = !this.get('channels')[cIndex].active;
|
522 | 521 | }
|
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 | + } |
524 | 531 | },
|
525 | 532 |
|
526 | 533 | save_channel_window: function(cIndex, new_w) {
|
|
0 commit comments