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

Method selected_changed

js/src/IndexSelector.ts:130–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128 }
129
130 selected_changed() {
131 if (this.dirty) {
132 //this change was most probably triggered from the js side and
133 //should be ignored.
134 return;
135 }
136 //reposition the interval selector and set the selected attribute.
137 const selected = this.model.get('selected') || [];
138 if (selected.length === 0) {
139 this.reset();
140 } else if (selected.length != 1) {
141 // invalid value for selected. Ignoring the value
142 return;
143 } else {
144 const pixel = this.scale.scale(selected[0]);
145 if (this.line !== undefined && this.line !== null) {
146 this.line
147 .attr('x1', pixel)
148 .attr('x2', pixel)
149 .attr('visibility', 'visible');
150 }
151 //the selected may be called before the index selector is
152 //active for the first time.
153 this.background.on('click', _.bind(this.click, this));
154 _.each(this.mark_views, (mark_view: any) => {
155 mark_view.invert_point(pixel);
156 });
157 }
158 }
159
160 relayout() {
161 super.relayout();

Callers 3

update_scale_domainMethod · 0.95
renderMethod · 0.45
marks_changedFunction · 0.45

Calls 2

resetMethod · 0.95
invert_pointMethod · 0.45

Tested by

no test coverage detected