(style_dict, indices?, elements?)
| 293 | } |
| 294 | |
| 295 | clear_style(style_dict, indices?, elements?) { |
| 296 | // Function to clear the style of a dict on some or all the elements of the |
| 297 | // chart. If indices is null, clears the style on all elements. If |
| 298 | // not, clears on only the elements whose indices are matching. |
| 299 | // |
| 300 | // If elements are passed, then indices are ignored and the style |
| 301 | // is cleared only on the elements that are passed. |
| 302 | // |
| 303 | // This can be used if we decide to accommodate more properties than |
| 304 | // those set by default. Because those have to cleared specifically. |
| 305 | // |
| 306 | if (Object.keys(style_dict).length === 0) { |
| 307 | // No style to clear |
| 308 | return; |
| 309 | } |
| 310 | |
| 311 | if (!elements || elements.length === 0) { |
| 312 | if (indices) { |
| 313 | elements = this.filterCellsByNum(this.indicesToCellNums(indices)); |
| 314 | } else { |
| 315 | elements = this.displayCells; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | const clearing_style = {}; |
| 320 | for (const key in style_dict) { |
| 321 | clearing_style[key] = null; |
| 322 | } |
| 323 | applyStyles(elements, clearing_style); |
| 324 | } |
| 325 | |
| 326 | private filterCellsByNum( |
| 327 | cell_numbers: number[] |
no test coverage detected