import type { Theme } from '../../../treb-base-types/src/index'; import { Rectangle } from '../../../treb-base-types/src/index'; import type { BaseLayout } from '../layout/base_layout'; import type { GridSelection, DataModel, ViewModel } from '../../../treb-data-model/src/index'; export declare class SelectionRenderer { private theme; private layout; private model; private view; private primary_selection; private additional_selections; nub_rectangle: Rectangle; cached_additional_selections: string; private grid_selections; private row_header_selections; private column_header_selections; private corner_selections; private row_overlay; private column_overlay; private corner_row_overlay; private corner_column_overlay; constructor(theme: Theme, layout: BaseLayout, model: DataModel, view: ViewModel, primary_selection: GridSelection, additional_selections: GridSelection[]); Initialize(): void; /** * we cache blocks that have inline style information. if style * information updates we will have to flush the cache and rebuild. * / public Flush() { // clean up, then call initialize to reconstruct for (const overlay of [ this.row_overlay, this.column_overlay, this.corner_row_overlay, this.corner_column_overlay, ]) { overlay.Remove(); } this.Initialize(); // selections: remove nodes from DOM, if connected, before cleaning up for (const group of [ this.grid_selections, this.row_header_selections, this.column_header_selections, this.corner_selections, ]) { for (const block of group) { // IE11 requires parentNode; seems to work in chrome/ffx, // so unify (was originally using parentElement) if (block.g.parentNode) { block.g.parentNode.removeChild(block.g); } } } this.grid_selections = []; this.row_header_selections = []; this.column_header_selections = []; this.corner_selections = []; } */ /** * renders all (primary and additional) selections. selections are painted * on a separate canvas which overlays the grid. unlike grid/header layers, * the selection canvas is transparent (alpha = true, which is default, so * omitted). * * updated for svg selections. erase is now required, so parameter is removed. * update: add an optional (default true) parameter to re-render additional * selections; this will support cache for selections that don't change. */ RenderSelections(show_primary_selection?: boolean, rerender?: boolean): void; /** * render a group of selections, optionally gated on one or two boolean * arrays (used to check if the selection is within some bounds) */ private RenderSelectionGroup; /** * create or return existing node. supports changing the offset, * as that may be variable. * * FIXME: now that this is in a single method, could inline? */ private EnsureGridSelectionBlock; private ClampEnd; /** * testing an SVG selection. index replaces primary; primary is always index 0. */ private RenderSVGSelection; }