diff options
author | alyssaf16 <alyssa_feinberg@brown.edu> | 2024-10-06 15:15:06 -0400 |
---|---|---|
committer | alyssaf16 <alyssa_feinberg@brown.edu> | 2024-10-06 15:15:06 -0400 |
commit | fbff73033b6c0f9b1214e9013c155ff085e7a737 (patch) | |
tree | e5a278de98cb71fa023af7b85e20aafaf5ab03bf /src/client/documents/DocUtils.ts | |
parent | fa54fdf2bf9bf8523da393a81ec1ac1cd4fa0f4c (diff) | |
parent | e61b2b356e761dfefda9d09bbbfc3c4a8d943f2c (diff) |
Merge branch 'alyssa-starter' of https://github.com/brown-dash/Dash-Web into alyssa-starter
Diffstat (limited to 'src/client/documents/DocUtils.ts')
-rw-r--r-- | src/client/documents/DocUtils.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/documents/DocUtils.ts b/src/client/documents/DocUtils.ts index 1696de7ad..acaefe783 100644 --- a/src/client/documents/DocUtils.ts +++ b/src/client/documents/DocUtils.ts @@ -34,11 +34,8 @@ import { OpenWhere } from '../views/nodes/OpenWhere'; import { TaskCompletionBox } from '../views/nodes/TaskCompletedBox'; import { DocumentType } from './DocumentTypes'; import { Docs, DocumentOptions } from './Documents'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports -const { DFLT_IMAGE_NATIVE_DIM } = require('../views/global/globalCssVariables.module.scss'); // prettier-ignore - -const defaultNativeImageDim = 10000000; //Number(DFLT_IMAGE_NATIVE_DIM.replace('px', '')); +import { DocumentView } from '../views/nodes/DocumentView'; +import { CollectionFreeFormView } from '../views/collections/collectionFreeForm'; export namespace DocUtils { function matchFieldValue(doc: Doc, key: string, valueIn: unknown): boolean { @@ -381,6 +378,11 @@ export namespace DocUtils { }, StrCast(dragDoc.title)), icon: Doc.toIcon(dragDoc), })) as ContextMenuProps[]; + documentList.push({ + description: ':Smart Drawing', + event: e => (DocumentView.Selected().lastElement().ComponentView as CollectionFreeFormView)?.showSmartDraw(e?.x || 0, e?.y || 0), + icon: 'file', + }); ContextMenu.Instance.addItem({ description: 'Create document', subitems: documentList, @@ -624,7 +626,7 @@ export namespace DocUtils { export function assignImageInfo(result: Upload.FileInformation, protoIn: Doc) { const proto = protoIn; if (Upload.isImageInformation(result)) { - const maxNativeDim = Math.min(Math.max(result.nativeHeight, result.nativeWidth), defaultNativeImageDim); + const maxNativeDim = Math.max(result.nativeHeight, result.nativeWidth); const exifRotation = StrCast(result.exifData?.data?.Orientation).toLowerCase(); proto.data_nativeOrientation = result.exifData?.data?.image?.Orientation ?? (exifRotation.includes('rotate 90') || exifRotation.includes('rotate 270') ? 5 : undefined); proto.data_nativeWidth = result.nativeWidth < result.nativeHeight ? (maxNativeDim * result.nativeWidth) / result.nativeHeight : maxNativeDim; |