diff options
| author | Sophie Zhang <sophie_zhang@brown.edu> | 2024-02-22 13:39:42 -0500 |
|---|---|---|
| committer | Sophie Zhang <sophie_zhang@brown.edu> | 2024-02-22 13:39:42 -0500 |
| commit | b960beb2f31327becdf6709a61b90523abdee65a (patch) | |
| tree | 66b3acb69b6d0b0dc69f2691c66c974f9bc73989 /src/client/views/collections/collectionFreeForm | |
| parent | 3f33a680af31a04b58c6163fda53a80a737837c6 (diff) | |
layout progress
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 1e0840495..19948b7eb 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1649,15 +1649,22 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection return url.href.replace(ext, '_m' + ext); } + @action + smartLayout = async () => {}; + + roundToRoundNumber = (num: number) => { + return Math.round(num / 10) * 10; + }; + // gpt layout @action gptLayout = async () => { const docLayouts = this.childDocs.map(doc => ({ - width: NumCast(doc.width), - height: NumCast(doc.height), - content: StrCast(doc.title), + width: this.roundToRoundNumber(NumCast(doc.width)), + height: this.roundToRoundNumber(NumCast(doc.height)), + // content: StrCast(doc.title), })); - console.log(docLayouts); + console.log('Doc layouts', docLayouts); const res = await smartLayout2(docLayouts); console.log('Smart layout result', res); @@ -1752,6 +1759,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection // Want to condense into a Smart Organize button this._props.renderDepth && optionItems.push({ description: 'Style with AI', event: this.gptStyling, icon: 'paint-brush' }); this._props.renderDepth && optionItems.push({ description: 'Smart Layout', event: this.gptLayout, icon: 'object-group' }); + // this._props.renderDepth && optionItems.push({ description: 'Smart Organize', event: this.smartOrganize, icon: 'object-group' }); if (!Doc.noviceMode) { optionItems.push({ description: (!Doc.NativeWidth(this.layoutDoc) || !Doc.NativeHeight(this.layoutDoc) ? 'Freeze' : 'Unfreeze') + ' Aspect', event: this.toggleNativeDimensions, icon: 'snowflake' }); } |
