import { Point } from "../../../Core/Point"; import { Rect } from "../../../Core/Rect"; import { IRenderContext2D } from "../../Drawing/IRenderContext2D"; import { CoordinateCalculatorBase } from "../../Numerics/CoordinateCalculators/CoordinateCalculatorBase"; import { SciChartSurfaceBase } from "../SciChartSurfaceBase"; import { BoxAnnotation, IBoxAnnotationOptions } from "./BoxAnnotation"; import { EAnnotationType, IAnnotation } from "./IAnnotation"; export interface ICompositeAnnotationOptions extends IBoxAnnotationOptions { annotations?: IAnnotation[]; } /** * Interface for composite annotations that group multiple annotations together */ export interface ICompositeAnnotation extends IAnnotation { /** Gets or sets the collection of child annotations */ annotations: IAnnotation[]; } /** * Parent annotation that groups other annotations and keeps child positions * relative to the parent box. * * `CompositeAnnotation` is intentionally much simpler than * {@link MultiPointAnnotationBase}. It does not define its own multi-point * geometry, snapping, label anchors, segment labels or drag-grip model. Instead, * it acts as a lightweight container: child annotations are attached to the same * surface, assigned this annotation as their parent and repositioned when the * composite box moves or resizes. * * Use this when several existing annotations should behave like one grouped * object. Use {@link MultiPointAnnotationBase} derived annotations when the * annotation itself is defined by multiple points and needs labels, snapping or * specialized editing handles. */ export declare class CompositeAnnotation extends BoxAnnotation implements ICompositeAnnotation { /** @inheritdoc */ readonly type = EAnnotationType.CompositeAnnotation; private readonly children; private readonly relativePositions; private isUpdatingChildren; /** * Creates a new {@link CompositeAnnotation} * @param options Configuration options. See {@link ICompositeAnnotationOptions} for details. */ constructor(options?: ICompositeAnnotationOptions); /** * Gets the child annotations contained within this composite. * This array should be treated as read-only. */ get annotations(): IAnnotation[]; /** * Replaces all child annotations in the composite. * Existing children will be removed before adding the new ones. */ set annotations(value: IAnnotation[]); /** * Adds one or more annotations to the composite. * Duplicate or invalid annotations are ignored. * @param items Child annotation(s) to add */ add(...items: IAnnotation[]): void; /** * Removes a child annotation from the composite. * @param annotation The child annotation to remove * @param callDeleteOnChildren When `true`, calls delete() on the removed child */ remove(annotation: IAnnotation, callDeleteOnChildren?: boolean): void; /** * Removes all child annotations from the composite. * @param callDeleteOnChildren When true, it also deletes the child annotations, which removes the memory claimed by the child annotations. * * Default `true` */ clear(callDeleteOnChildren?: boolean): void; /** * Sets a normalized relative position for a child annotation. * Coordinates are expressed in the range [0..1] relative to the parent bounds. * @param child The child annotation * @param x1 Normalized X1 position * @param y1 Normalized Y1 position * @param x2 Optional normalized X2 position * @param y2 Optional normalized Y2 position */ setChildRelativePosition(child: IAnnotation, x1: number, y1: number, x2?: number, y2?: number): void; /** @inheritdoc */ onAttach(surface: SciChartSurfaceBase): void; /** @inheritdoc */ onDetach(): void; /** @inheritdoc */ drawWithContext(renderContext: IRenderContext2D, xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase, seriesViewRect: Rect, surfaceViewRect: Rect, chartViewRect: Rect): void; /** @inheritdoc */ calcDragDistance(xyValues: Point): void; private attachChild; private captureInitialPosition; private updateAllChildren; private ensureNormalized; private updateChildPosition; private syncPropertiesToChildren; /** @inheritdoc */ protected notifyPropertyChanged(propertyName: string): void; /** @inheritdoc */ toJSON(): { type: EAnnotationType; options: Required>; }; /** @inheritdoc */ delete(): void; }