(plotsIdResponse: HttpgdIdResponse[], redraw: boolean = false, force: boolean = false)
| 590 | } |
| 591 | |
| 592 | protected async refreshPlots(plotsIdResponse: HttpgdIdResponse[], redraw: boolean = false, force: boolean = false): Promise<void> { |
| 593 | const nPlots = this.plots.length; |
| 594 | let plotIds = plotsIdResponse.map((x) => x.id); |
| 595 | plotIds = plotIds.filter((id) => !this.hiddenPlots.includes(id)); |
| 596 | const newPlotPromises = plotIds.map(async (id) => { |
| 597 | const plot = this.plots.find((plt) => plt.id === id); |
| 598 | if (force || !plot || id === this.activePlot) { |
| 599 | return await this.getPlotContent(id, this.viewWidth, this.viewHeight, this.zoom); |
| 600 | } else { |
| 601 | return plot; |
| 602 | } |
| 603 | }); |
| 604 | const newPlots = await Promise.all(newPlotPromises); |
| 605 | const oldPlotIds = this.plots.map(plt => plt.id); |
| 606 | this.plots = newPlots; |
| 607 | if (this.plots.length !== nPlots) { |
| 608 | this.activePlot = this.plots[this.plots.length - 1]?.id; |
| 609 | } |
| 610 | if (redraw || !this.webviewPanel) { |
| 611 | this.refreshHtml(); |
| 612 | } else { |
| 613 | for (const plt of this.plots) { |
| 614 | if (oldPlotIds.includes(plt.id)) { |
| 615 | this.updatePlot(plt); |
| 616 | } else { |
| 617 | this.addPlot(plt); |
| 618 | } |
| 619 | } |
| 620 | this._focusPlot(); |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | protected updatePlot(plt: HttpgdPlot<string>): void { |
| 625 | const msg: UpdatePlotMessage = { |
no test coverage detected