diff options
| author | eleanor-park <eleanor_park@brown.edu> | 2024-08-27 16:22:33 -0400 |
|---|---|---|
| committer | eleanor-park <eleanor_park@brown.edu> | 2024-08-27 16:22:33 -0400 |
| commit | 6f73686ec4dc3e01ae3eacc0150aa59eafea0325 (patch) | |
| tree | 392d6ebcb6122326441afbb7dfe69ff4cb583c1d /src/client/views/smartdraw/AnnotationPalette.tsx | |
| parent | fd5278045e8c2e280d81cb965c0b2cc5afb59be8 (diff) | |
pulling from master
Diffstat (limited to 'src/client/views/smartdraw/AnnotationPalette.tsx')
| -rw-r--r-- | src/client/views/smartdraw/AnnotationPalette.tsx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/views/smartdraw/AnnotationPalette.tsx b/src/client/views/smartdraw/AnnotationPalette.tsx index 7e4d46204..7f00fa2f2 100644 --- a/src/client/views/smartdraw/AnnotationPalette.tsx +++ b/src/client/views/smartdraw/AnnotationPalette.tsx @@ -107,6 +107,10 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett this._props.Document[DocData].data = undefined; }; + /** + * Adds a doc to the annotation palette. Gets a snapshot of the document to use as a preview in the palette. When this + * preview is dragged onto a parent document, a copy of that document is added as an annotation. + */ public static addToPalette = async (doc: Doc) => { if (!doc.savedAsAnno) { const clone = await Doc.MakeClone(doc); @@ -129,6 +133,10 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett return undefined; } + /** + * Calls the draw with GPT functions in SmartDrawHandler to allow users to generate drawings straight from + * the annotation palette. + */ @undoBatch generateDrawings = action(async () => { this._isLoading = true; @@ -159,6 +167,11 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett Doc.AddDocToList(this._props.Document, 'data', drawing); }; + /** + * Saves the currently showing, newly generated drawing to the annotation palette and sets the metadata. + * AddToPalette() is generically used to add any document to the palette, while this defines the behavior for when a user + * presses the "save drawing" button. + */ saveDrawing = async () => { const cIndex: number = this._props.Document.carousel_index as number; const focusedDrawing = DocListCast(this._props.Document.data)[cIndex]; |
