()
| 357 | } |
| 358 | |
| 359 | apply_styles() { |
| 360 | this.clear_style(this.selected_style); |
| 361 | this.clear_style(this.unselected_style); |
| 362 | this.clear_style(this.anchorStyle); |
| 363 | |
| 364 | this.set_default_style([], this.displayCells); |
| 365 | |
| 366 | const selected_cell_nums = this.indicesToCellNums( |
| 367 | this.selected_indices as [number, number][] |
| 368 | ); |
| 369 | const unsel_cell_nums = |
| 370 | selected_cell_nums === null || selected_cell_nums.length === 0 |
| 371 | ? [] |
| 372 | : _.difference( |
| 373 | _.range(this.numRows * this.numColumns), |
| 374 | selected_cell_nums |
| 375 | ); |
| 376 | |
| 377 | this.selectedElements = this.filterCellsByNum(selected_cell_nums); |
| 378 | this.set_style_on_elements( |
| 379 | this.selected_style, |
| 380 | this.selected_indices, |
| 381 | this.selectedElements |
| 382 | ); |
| 383 | |
| 384 | this.unselectedElements = this.filterCellsByNum(unsel_cell_nums); |
| 385 | this.set_style_on_elements( |
| 386 | this.unselected_style, |
| 387 | [], |
| 388 | this.unselectedElements |
| 389 | ); |
| 390 | |
| 391 | if (this.anchorCellIndex !== null && this.anchorCellIndex !== undefined) { |
| 392 | const anchorNum = this.indicesToCellNums([this.anchorCellIndex]); |
| 393 | this.set_style_on_elements( |
| 394 | this.anchorStyle, |
| 395 | [], |
| 396 | this.filterCellsByNum(anchorNum) |
| 397 | ); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | style_updated(new_style, indices, elements) { |
| 402 | // reset the style of the elements and apply the new style |
no test coverage detected