()
| 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(); |
no test coverage detected