MCPcopy Index your code
hub / github.com/bqplot/bqplot / syncModelToBrush

Method syncModelToBrush

js/src/BrushSelector.ts:736–763  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

734 }
735
736 private syncModelToBrush() {
737 // Move and redraw the brush selectors, preventing move events to be triggered
738 this.ignoreBrushEvents = true;
739 try {
740 const selected = this.model.get('_selected');
741
742 this.brushes.forEach((brush, index) => {
743 const brushSelected = selected[this.get_label(index)];
744
745 if (brushSelected) {
746 const range = brushSelected
747 .map((v) => this.scale.scale(v))
748 .sort(sort);
749
750 this.update_text(index, range);
751 brush.move(this.brush_g[index], range);
752 } else {
753 this.update_text(index, null);
754 brush.move(this.brush_g[index], null);
755 }
756
757 this.brush_g[index].call(brush);
758 this.reset_handler(this.brush_g[index]);
759 });
760 } finally {
761 this.ignoreBrushEvents = false;
762 }
763 }
764
765 remove() {
766 this.model.off('change:names', null, this);

Callers 1

relayoutMethod · 0.95

Calls 3

get_labelMethod · 0.95
update_textMethod · 0.95
reset_handlerMethod · 0.95

Tested by

no test coverage detected