(options?: { readonly requestRenderAfter?: boolean })
| 2203 | }; |
| 2204 | |
| 2205 | const executeFlush = (options?: { readonly requestRenderAfter?: boolean }): void => { |
| 2206 | if (disposed) return; |
| 2207 | |
| 2208 | const requestRenderAfter = options?.requestRenderAfter ?? true; |
| 2209 | |
| 2210 | const didAppend = flushPendingAppends(); |
| 2211 | |
| 2212 | const zoomRange = zoomState?.getRange() ?? null; |
| 2213 | const zoomIsFullSpan = isFullSpanZoomRange(zoomRange); |
| 2214 | const zoomActiveNotFullSpan = zoomRange != null && !zoomIsFullSpan; |
| 2215 | |
| 2216 | let didResample = false; |
| 2217 | |
| 2218 | // Zoom changes (debounced): apply on flush. |
| 2219 | if (zoomResampleDue) { |
| 2220 | zoomResampleDue = false; |
| 2221 | cancelZoomResampleDebounce(); |
| 2222 | |
| 2223 | if (!zoomRange || zoomIsFullSpan) { |
| 2224 | renderSeries = runtimeBaseSeries; |
| 2225 | // Recompute visible y-bounds from the baseline series |
| 2226 | recomputeCachedVisibleYBoundsIfNeeded(); |
| 2227 | } else { |
| 2228 | recomputeRenderSeries(); |
| 2229 | } |
| 2230 | didResample = true; |
| 2231 | } else if (didAppend && zoomActiveNotFullSpan) { |
| 2232 | // Appends during an active zoom window require resampling the visible range. |
| 2233 | // (Avoid doing this work when zoom is full-span or disabled.) |
| 2234 | zoomResampleDue = false; |
| 2235 | cancelZoomResampleDebounce(); |
| 2236 | recomputeRenderSeries(); |
| 2237 | didResample = true; |
| 2238 | } |
| 2239 | |
| 2240 | if ((didAppend || didResample) && requestRenderAfter) { |
| 2241 | requestRender(); |
| 2242 | } |
| 2243 | }; |
| 2244 | |
| 2245 | const scheduleFlush = (options?: { readonly immediate?: boolean }): void => { |
| 2246 | if (disposed) return; |
no test coverage detected