aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw/StickerPalette.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-23 10:27:28 -0400
committerbobzel <zzzman@gmail.com>2025-03-23 10:27:28 -0400
commitd0fccd1050f5d6ccc24c1e4d2b7d1c0ed94fb2a7 (patch)
treede590c363ca12b13a93c4ba12005a8d76b633759 /src/client/views/smartdraw/StickerPalette.tsx
parentbc308b888f41e8789f1b9f522ced46e68e726862 (diff)
updated more [DocData] to .$ things
Diffstat (limited to 'src/client/views/smartdraw/StickerPalette.tsx')
-rw-r--r--src/client/views/smartdraw/StickerPalette.tsx28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/client/views/smartdraw/StickerPalette.tsx b/src/client/views/smartdraw/StickerPalette.tsx
index e3305851a..080a05d42 100644
--- a/src/client/views/smartdraw/StickerPalette.tsx
+++ b/src/client/views/smartdraw/StickerPalette.tsx
@@ -9,7 +9,6 @@ import ReactLoading from 'react-loading';
import { returnEmptyFilter, returnFalse, returnTrue } from '../../../ClientUtils';
import { emptyFunction, numberRange } from '../../../Utils';
import { Doc, DocListCast, returnEmptyDoclist } from '../../../fields/Doc';
-import { DocData } from '../../../fields/DocSymbols';
import { ImageCast, NumCast } from '../../../fields/Types';
import { ImageField } from '../../../fields/URLField';
import { DocumentType } from '../../documents/DocumentTypes';
@@ -133,7 +132,7 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps
this._canInteract = true;
this._opts = { text: '', complexity: 5, size: 200, autoColor: true, x: 0, y: 0 };
this._gptRes = [];
- this._props.Document[DocData].data = undefined;
+ this._props.Document.$data = undefined;
});
/**
@@ -143,8 +142,8 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps
@undoBatch
generateDrawings = action(() => {
this._isLoading = true;
- const prevDrawings = DocListCast(this._props.Document[DocData].data);
- this._props.Document[DocData].data = undefined;
+ const prevDrawings = DocListCast(this._props.Document.$data);
+ this._props.Document.$data = undefined;
SmartDrawHandler.Instance.AddDrawing = this.addDrawing;
this._canInteract = false;
Promise.all(
@@ -164,7 +163,7 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps
@action
addDrawing = (drawing: Doc, opts: DrawingOptions, gptRes: string) => {
this._gptRes.push(gptRes);
- drawing[DocData].freeform_fitContentsToBox = true;
+ drawing.$freeform_fitContentsToBox = true;
Doc.AddDocToList(this._props.Document, 'data', drawing);
};
@@ -176,17 +175,16 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps
saveDrawing = () => {
const cIndex = NumCast(this._props.Document.carousel_index);
const focusedDrawing = DocListCast(this._props.Document.data)[cIndex];
- const docData = focusedDrawing[DocData];
- docData.title = this._opts.text?.match(/^(.*?)~~~.*$/)?.[1] || this._opts.text;
- docData.ai_drawing_input = this._opts.text;
- docData.ai_drawing_complexity = this._opts.complexity;
- docData.ai_drawing_colored = this._opts.autoColor;
- docData.ai_drawing_size = this._opts.size;
- docData.ai_drawing_data = this._gptRes[cIndex];
- docData.ai = 'gpt';
+ focusedDrawing.$title = this._opts.text?.match(/^(.*?)~~~.*$/)?.[1] || this._opts.text;
+ focusedDrawing.$ai_drawing_input = this._opts.text;
+ focusedDrawing.$ai_drawing_complexity = this._opts.complexity;
+ focusedDrawing.$ai_drawing_colored = this._opts.autoColor;
+ focusedDrawing.$ai_drawing_size = this._opts.size;
+ focusedDrawing.$ai_drawing_data = this._gptRes[cIndex];
+ focusedDrawing.$ai = 'gpt';
focusedDrawing.width = this._opts.size;
- docData.x = this._opts.x;
- docData.y = this._opts.y;
+ focusedDrawing.x = this._opts.x;
+ focusedDrawing.y = this._opts.y;
StickerPalette.addToPalette(focusedDrawing).then(() => this.resetPalette(true));
};