From b56d2c2ae115e81fbf7aeaae0d2fed9ba073f11d Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 1 Oct 2024 15:19:52 -0400 Subject: more annopalette related cleanup --- src/client/views/smartdraw/AnnotationPalette.tsx | 4 ++-- src/client/views/smartdraw/SmartDrawHandler.tsx | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'src/client/views/smartdraw') diff --git a/src/client/views/smartdraw/AnnotationPalette.tsx b/src/client/views/smartdraw/AnnotationPalette.tsx index 0c8dbf12d..4421547be 100644 --- a/src/client/views/smartdraw/AnnotationPalette.tsx +++ b/src/client/views/smartdraw/AnnotationPalette.tsx @@ -13,7 +13,7 @@ import { DocData } from '../../../fields/DocSymbols'; import { ImageCast } from '../../../fields/Types'; import { DocumentType } from '../../documents/DocumentTypes'; import { Docs } from '../../documents/Documents'; -import { makeUserTemplateImage } from '../../util/DropConverter'; +import { makeUserTemplateButtonOrImage } from '../../util/DropConverter'; import { SettingsManager } from '../../util/SettingsManager'; import { Transform } from '../../util/Transform'; import { undoBatch } from '../../util/UndoManager'; @@ -123,7 +123,7 @@ export class AnnotationPalette extends ObservableReactComponent { this._canInteract = false; if (this.ShowRegenerate) { await this.regenerate(); - this._regenInput = ''; - this._showEditBox = false; + runInAction(() => { + this._regenInput = ''; + this._showEditBox = false; + }); } else { - this._showOptions = false; + runInAction(() => { + this._showOptions = false; + }); try { await this.drawWithGPT({ X: this._pageX, Y: this._pageY }, this._userInput, this._complexity, this._size, this._autoColor); this.hideSmartDrawHandler(); - this.ShowRegenerate = true; + + runInAction(() => { + this.ShowRegenerate = true; + }); } catch (err) { if (this._errorOccurredOnce) { console.error('GPT call failed', err); @@ -212,8 +219,10 @@ export class SmartDrawHandler extends ObservableReactComponent { } } } - this._isLoading = false; - this._canInteract = true; + runInAction(() => { + this._isLoading = false; + this._canInteract = true; + }); }; /** -- cgit v1.2.3-70-g09d2