From 87a080bae1219e762161139d3011345fbc0bacd8 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Tue, 15 Apr 2025 17:25:49 -0400 Subject: [PATCH] Update type definitions for elements This adds type definitions for the properties accessed by the draggable demo: https://www.chartjs.org/chartjs-plugin-annotation/latest/samples/interaction/dragging.html --- CONTRIBUTING.md | 2 +- types/element.d.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 763ff3a9f..3236a4bdc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ Please do not use issues for support requests. For help using the annotation plu Well structured, detailed bug reports are hugely valuable for the project. -Guidlines for reporting bugs: +Guidelines for reporting bugs: - Check the issue search to see if it has already been reported - Isolate the problem to a simple test case diff --git a/types/element.d.ts b/types/element.d.ts index 8ed43be07..62362d588 100644 --- a/types/element.d.ts +++ b/types/element.d.ts @@ -10,9 +10,16 @@ export interface AnnotationBoxModel { height: number, width: number, radius?: number + // Used by polygon annotations' child point AnnotationElements + bx?: number; + by?: number; } export interface AnnotationElement extends AnnotationBoxModel { label?: AnnotationElement, - options: AnnotationOptions + options: AnnotationOptions, + /** + * Sub-elements: e.g., a box annotation's label, or a polygon's points + */ + elements?: AnnotationElement[], }