I have the following two types:
export default interface ImageDataForAnnotation {
src: string;
name: string;
key: number;
regions?: Annotation[]; //This is defined below
pixelSize?: PixelSize
}
export interface Annotation {
type: string,
x: number,
y: number,
w: number,
h: number,
highlighted: boolean,
editingLabels: boolean,
color: string,
cls: string | undefined,
id: number,
image?: number,
}
Then i have an array where each image holds a number of annotations
const [images, addImage] = useState<Array<ImageDataForAnnotation>>([]);
//Definition of arary
let imageArray = [...images];
I then want to edit an annotation in a given image, where i have both indexes to do something like: imageArray[image_index].regions![annotation_index].update(new_annotation)