From 859bb1b733901e4697f1d53781af725e4830c607 Mon Sep 17 00:00:00 2001 From: eleanor-park Date: Tue, 14 Jan 2025 17:19:16 +0100 Subject: added drawing fill style reference --- src/client/views/nodes/DocumentView.tsx | 1 + src/client/views/nodes/FieldView.tsx | 1 + src/client/views/nodes/ImageBox.scss | 9 ++--- src/client/views/nodes/ImageBox.tsx | 62 ++++++++++++++++++++------------- 4 files changed, 42 insertions(+), 31 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 640d27aa1..44b214644 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -718,6 +718,7 @@ export class DocumentViewInternal extends DocComponent this._props.PanelWidth() - this._aiWinHeight; rph = () => this.panelHeight() - this._aiWinHeight; + @computed get viewBoxContents() { TraceMobx(); const isInk = this.layoutDoc._layout_isSvg && !this._props.LayoutTemplateString; diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx index 02d4d9adb..2e40f39ed 100644 --- a/src/client/views/nodes/FieldView.tsx +++ b/src/client/views/nodes/FieldView.tsx @@ -68,6 +68,7 @@ export interface FieldViewSharedProps { isGroupActive?: () => string | undefined; // is this document part of a group that is active // eslint-disable-next-line no-use-before-define setContentViewBox?: (view: ViewBoxInterface) => void; // called by rendered field's viewBox so that DocumentView can make direct calls to the viewBox + PanelWidth: () => number; PanelHeight: () => number; isDocumentActive?: () => boolean | undefined; // whether a document should handle pointer events diff --git a/src/client/views/nodes/ImageBox.scss b/src/client/views/nodes/ImageBox.scss index 759f2584b..94a497cf0 100644 --- a/src/client/views/nodes/ImageBox.scss +++ b/src/client/views/nodes/ImageBox.scss @@ -163,6 +163,7 @@ .imageBox-aiView { text-align: center; font-weight: bold; + width: 100%; .imageBox-aiView-subtitle { position: relative; @@ -179,13 +180,7 @@ .imageBox-aiView-regenerate, .imageBox-aiView-options { display: flex; - flex-direction: row; - justify-content: center; - flex-direction: row; + margin: auto; gap: 5px; } - - .imageBox-aiView-input { - width: 50%; - } } diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 8a7fb99b1..3a9086777 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -96,8 +96,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { // variables for AI Image Editor @observable private _regenInput = ''; - @observable private _canInteract = true; - @observable private _regenerateLoading = false; + @observable private _regenLoading = false; @observable private _prevImgs: FireflyImageData[] = []; constructor(props: FieldViewProps) { @@ -535,20 +534,31 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { ); } + protected _btnWidth = 50; + protected _inputWidth = 50; + protected _sideBtnMaxPanelPct = 0.12; + @observable _filterFunc: ((doc: Doc) => boolean) | undefined = undefined; + @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 ( -
-
)}
- {showRegenerate && More Options: }
+ {showRegenerate && ( + + More Options: + + )}