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

Method selected_changed

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

Source from the content-addressed store, hash-verified

295 }
296
297 selected_changed() {
298 if (this.brushing) {
299 return;
300 }
301 //reposition the interval selector and set the selected attribute.
302 const selected_x = this.model.get('selected_x') || [],
303 selected_y = this.model.get('selected_y') || [];
304 if (selected_x.length === 0 || selected_y.length === 0) {
305 this.update_mark_selected();
306 } else if (selected_x.length != 2 || selected_y.length != 2) {
307 // invalid value for selected. Ignoring the value
308 return;
309 } else {
310 const pixel_extent_x = selected_x
311 .map((v) => this.x_scale.offset + this.x_scale.scale(v))
312 .sort(sort);
313 const pixel_extent_y = selected_y
314 .map((v) => this.y_scale.offset + this.y_scale.scale(v))
315 .sort(sort);
316 this.update_mark_selected(pixel_extent_x, pixel_extent_y);
317 }
318 this.syncModelToBrush();
319 }
320
321 relayout() {
322 super.relayout();

Callers 1

renderMethod · 0.95

Calls 2

syncModelToBrushMethod · 0.95
update_mark_selectedMethod · 0.45

Tested by

no test coverage detected