aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorsharkiecodes <lanyi_stroud@brown.edu>2025-03-11 16:27:30 -0400
committersharkiecodes <lanyi_stroud@brown.edu>2025-03-11 16:27:30 -0400
commit3f54517e96ccff233b1560627995024e137dbdfd (patch)
tree7c0ce1bb4cb7555425acf44bc5cd15876f90ee77 /src/fields/Doc.ts
parent04669ffeb163688c7aefd7b5face7998252abdca (diff)
Doing outpainting implementation
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index fc89dcbe7..dded8ce03 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -468,6 +468,10 @@ export class Doc extends RefField {
}
}
export namespace Doc {
+ export let SelectOnLoad: Doc | undefined;
+ export function SetSelectOnLoad(doc: Doc | undefined) {
+ SelectOnLoad = doc;
+ }
export let DocDragDataName: string = '';
export function SetDocDragDataName(name: string) {
DocDragDataName = name;
@@ -1177,6 +1181,27 @@ export namespace Doc {
const dheight = NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '_nativeHeight'], useHeight ? NumCast(doc._height) : 0);
return NumCast(doc._nativeHeight, nheight || dheight);
}
+
+
+ export function OutpaintingWidth(doc?: Doc, dataDoc?: Doc, useWidth?: boolean) {
+ return !doc ? 0 : NumCast(doc._outpaintingWidth, NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '_outpaintingWidth'], useWidth ? NumCast(doc._width) : 0));
+ }
+
+ export function OutpaintingHeight(doc?: Doc, dataDoc?: Doc, useHeight?: boolean) {
+ if (!doc) return 0;
+ const oheight = (Doc.OutpaintingWidth(doc, dataDoc, useHeight) / NumCast(doc._width)) * NumCast(doc._height);
+ const dheight = NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '_outpaintingHeight'], useHeight ? NumCast(doc._height) : 0);
+ return NumCast(doc._outpaintingHeight, oheight || dheight);
+ }
+
+ export function SetOutpaintingWidth(doc: Doc, width: number | undefined, fieldKey?: string) {
+ doc[(fieldKey || Doc.LayoutFieldKey(doc)) + '_outpaintingWidth'] = width;
+ }
+
+ export function SetOutpaintingHeight(doc: Doc, height: number | undefined, fieldKey?: string) {
+ doc[(fieldKey || Doc.LayoutFieldKey(doc)) + '_outpaintingHeight'] = height;
+ }
+
export function SetNativeWidth(doc: Doc, width: number | undefined, fieldKey?: string) {
doc[(fieldKey || Doc.LayoutFieldKey(doc)) + '_nativeWidth'] = width;
}