From b0903079ab0abbc65e927d70ee0f6bb593865869 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 16 Jan 2025 12:00:52 -0500 Subject: fixed style references for generating ai images. fixed some error cases. --- src/client/views/nodes/DocumentView.scss | 1 - src/client/views/nodes/ImageBox.tsx | 56 +++++++++++++++++--------------- 2 files changed, 29 insertions(+), 28 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/DocumentView.scss b/src/client/views/nodes/DocumentView.scss index e71f391c6..cd813cb67 100644 --- a/src/client/views/nodes/DocumentView.scss +++ b/src/client/views/nodes/DocumentView.scss @@ -281,7 +281,6 @@ .documentView-editorView { width: 100%; - overflow-y: scroll; scrollbar-width: thin; justify-items: center; background-color: rgb(223, 223, 223); diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index ec6ce8c2a..82d8ea5f1 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -13,7 +13,7 @@ import { DocData } from '../../../fields/DocSymbols'; import { Id } from '../../../fields/FieldSymbols'; import { InkTool } from '../../../fields/InkField'; import { ObjectField } from '../../../fields/ObjectField'; -import { Cast, ImageCast, NumCast, RTFCast, StrCast } from '../../../fields/Types'; +import { Cast, DocCast, ImageCast, NumCast, RTFCast, StrCast } from '../../../fields/Types'; import { ImageField } from '../../../fields/URLField'; import { TraceMobx } from '../../../fields/util'; import { emptyFunction } from '../../../Utils'; @@ -540,34 +540,31 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { protected _inputWidth = 50; protected _sideBtnMaxPanelPct = 0.12; @observable _filterFunc: ((doc: Doc) => boolean) | undefined = undefined; + @observable private _fireflyRefStrength = 0; @computed get contentScaling() { return this.ScreenToLocalBoxXf().Scale; } // prettier-ignore @computed get maxWidgetSize() { return Math.min(this._btnWidth * this.contentScaling, (this._props.fitWidth?.(this.Document) && this._props.PanelWidth() > NumCast(this.layoutDoc._width) ? 1 : this._sideBtnMaxPanelPct) * NumCast(this.layoutDoc.width, 1)); } // prettier-ignore @computed get uiBtnScaling() { return this.maxWidgetSize / this._btnWidth; } // prettier-ignore @computed get uiInputScaling() { return this.maxWidgetSize / this._inputWidth; } // prettier-ignore - componentAIViewHistory = () => { - const imgs: FireflyImageData[] = this.dataDoc.ai_firefly_history ? JSON.parse(StrCast(this.dataDoc.ai_firefly_history)) : []; - return ( -
-
- ); - }; - @observable private _fireflyRefStrength = 0; + componentAIViewHistory = () => ( +
+
+ ); componentAIView = () => { const field = this.dataDoc[this.fieldKey] instanceof ImageField ? Cast(this.dataDoc[this.fieldKey], ImageField, null) : new ImageField(String(this.dataDoc[this.fieldKey])); @@ -611,7 +608,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { onClick={action(async () => { this._regenerateLoading = true; if (this._fireflyRefStrength) { - DrawingFillHandler.drawingToImage(this.props.Document, this._fireflyRefStrength, this._regenInput || StrCast(this.Document.title))?.then( + DrawingFillHandler.drawingToImage(this.props.Document, this._fireflyRefStrength, this._regenInput || StrCast(this.Document.title), this.Document)?.then( action(() => { this._regenerateLoading = false; }) @@ -640,7 +637,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() {
More Options:
- {showRegenerate && ( + {SmartDrawHandler.Instance.ShowRegenerate && ( More Options: @@ -692,7 +689,12 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { }).then((info: Upload.ImageInformation) => { const img = Docs.Create.ImageDocument(info.accessPaths.agnostic.client, { title: 'expand:' + this.Document.title }); DocUtils.assignImageInfo(info, img); - this._props.addDocTab(img, OpenWhere.addRight); + const genratedDocs = this.Document.generatedDocs + ? DocCast(this.Document.generatedDocs) + : Docs.Create.MasonryDocument([], { _width: 400, _height: 400, x: NumCast(this.Document.x) + NumCast(this.Document.width), y: NumCast(this.Document.y) }); + Doc.AddDocToList(genratedDocs, undefined, img); + this.Document[DocData].generatedDocs = genratedDocs; + if (!DocumentView.getFirstDocumentView(genratedDocs)) this._props.addDocTab(genratedDocs, OpenWhere.addRight); }); }} /> -- cgit v1.2.3-70-g09d2