@@ -985,26 +1022,31 @@ enum FieldSize {
HUGE = 'huge'
}
+type Field = {
+ tl: [number, number],
+ br: [number, number],
+ types: FieldType[],
+ sizes?: FieldSize[],
+ opts: FieldOpts;
+};
+
export interface TemplateDocInfos {
height: number;
width: number;
- fields: {tl: [number, number], br: [number, number], types: FieldType[], sizes?: FieldSize[]}[];
-}
-
-export interface TemplateDocField {
- coordinates: {tl: [number, number], br: [number, number]};
- getDoc: (parentWidth: number, parentHeight: number, title: string, content: string) => Doc;
+ fields: Field[];
}
export interface FieldOpts {
backgroundColor?: string;
- roundedCorners?: boolean;
- vertCenteredText?: boolean;
- horizCenteredText?: boolean;
- transparency?: number;
+ color?: string;
+ cornerRounding?: number;
+ borderWidth?: number;
+ borderColor?: string;
+ contentXCentering?: 'left' | 'center' | 'right';
+ contentYCentering?: 'top' | 'center' | 'bottom';
+ opacity?: number;
rotation?: number;
//animation?: boolean;
- fontColor?: string;
fontBold?: boolean;
fontTransform?: 'toUpper' | 'toLower';
}
@@ -1023,7 +1065,9 @@ export class FieldFuncs {
public static TextField = (coords: {tl: [number, number], br: [number, number]}, parentWidth: number, parentHeight: number, title: string, content: string, opts: FieldOpts) => {
const {width, height, coord} = FieldFuncs.getDimensions(coords, parentWidth, parentHeight);
- const doc = Docs.Create.TextDocument(content, {
+ const bool = true;
+
+ const docWithBasicOpts = (Docs.Create.TextDocument)(content, {
_height: height,
_width: width,
title: title,
@@ -1031,11 +1075,15 @@ export class FieldFuncs {
y: coord.y,
_text_fontSize: `${height/2}` ,
backgroundColor: opts.backgroundColor ?? '',
-
-
- })
+ color: opts.color,
+ _layout_borderRounding: `${opts.cornerRounding}`,
+ borderWidth: opts.borderWidth,
+ borderColor: opts.borderColor,
+ opacity: opts.opacity,
+ _layout_centered: opts.contentXCentering === 'center' ? true : false,
+ });
- return doc;
+ return docWithBasicOpts;
}
public static ImageField = (coords: {tl: [number, number], br: [number, number]}, parentWidth: number, parentHeight: number, title: string, content: string) => {
@@ -1071,70 +1119,82 @@ export class TemplateLayouts {
tl: [-.6, -.9],
br: [.6, -.8],
types: [FieldType.TEXT],
- sizes: [FieldSize.TINY]
+ sizes: [FieldSize.TINY],
+ opts: {
+
+ }
}, {
tl: [-.9, -.7],
br: [.9, .2],
types: [FieldType.TEXT, FieldType.VISUAL],
- sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE]
+ sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE],
+ opts: {
+
+ }
}, {
tl: [-.6, .3],
br: [.6, .4],
types: [FieldType.TEXT],
- sizes: [FieldSize.TINY]
+ sizes: [FieldSize.TINY],
+ opts: {
+
+ }
}, {
tl: [-.9, .5],
br: [.9, .9],
types: [FieldType.TEXT, FieldType.VISUAL],
- sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE]
- }]
- };
+ sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE],
+ opts: {
- public static FourField002: TemplateDocInfos = {
- width: 450,
- height: 600,
- fields: [{
- tl: [-.6, -.9],
- br: [.6, -.8],
- types: [FieldType.TEXT],
- sizes: [FieldSize.TINY]
- }, {
- tl: [-.9, -.7],
- br: [.9, .2],
- types: [FieldType.TEXT, FieldType.VISUAL],
- sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE]
- }, {
- tl: [-.9, .3],
- br: [-.05, .9],
- types: [FieldType.TEXT],
- sizes: [FieldSize.TINY]
- }, {
- tl: [.05, .3],
- br: [.9, .9],
- types: [FieldType.TEXT, FieldType.VISUAL],
- sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE]
+ }
}]
};
- public static TwoFieldPlusCarousel: TemplateDocInfos = {
- width: 500,
- height: 600,
- fields: [{
- tl: [-.9, -.99],
- br: [.9, -.7],
- types: [FieldType.TEXT],
- sizes: [FieldSize.TINY]
- }, {
- tl: [-.9, -.65],
- br: [.9, .35],
- types: [],
- sizes: []
- }, {
- tl: [-.9, .4],
- br: [.9, .95],
- types: [FieldType.TEXT],
- sizes: [FieldSize.TINY]
- }]
- };
+// public static FourField002: TemplateDocInfos = {
+// width: 450,
+// height: 600,
+// fields: [{
+// tl: [-.6, -.9],
+// br: [.6, -.8],
+// types: [FieldType.TEXT],
+// sizes: [FieldSize.TINY]
+// }, {
+// tl: [-.9, -.7],
+// br: [.9, .2],
+// types: [FieldType.TEXT, FieldType.VISUAL],
+// sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE]
+// }, {
+// tl: [-.9, .3],
+// br: [-.05, .9],
+// types: [FieldType.TEXT],
+// sizes: [FieldSize.TINY]
+// }, {
+// tl: [.05, .3],
+// br: [.9, .9],
+// types: [FieldType.TEXT, FieldType.VISUAL],
+// sizes: [FieldSize.MEDIUM, FieldSize.LARGE, FieldSize.HUGE]
+// }]
+// };
+
+// public static TwoFieldPlusCarousel: TemplateDocInfos = {
+// width: 500,
+// height: 600,
+// fields: [{
+// tl: [-.9, -.99],
+// br: [.9, -.7],
+// types: [FieldType.TEXT],
+// sizes: [FieldSize.TINY]
+// }, {
+// tl: [-.9, -.65],
+// br: [.9, .35],
+// types: [],
+// sizes: []
+// }, {
+// tl: [-.9, .4],
+// br: [.9, .95],
+// types: [FieldType.TEXT],
+// sizes: [FieldSize.TINY]
+// }]
+// };
}
\ No newline at end of file
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 3c898dea2..5af6e65de 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -948,12 +948,7 @@ export class DocumentViewInternal extends DocComponent
- //
- //
- //
- //
-
- //
);
}
@@ -1138,7 +1132,7 @@ export class DocumentView extends DocComponent() {
return Math.max(minTextScale, this._props.PanelHeight() / (this.effectiveNativeHeight || 1)); // height-limited or unscaled
}
@computed private get panelWidth() {
- return this.effectiveNativeWidth ? this.effectiveNativeWidth * this.nativeScaling : this._props.PanelWidth();
+ return this.effectiveNativeWidth ? this.effectiveNativeWidth * this.nativeScaling: this._props.PanelWidth();
}
@computed private get panelHeight() {
if (this.effectiveNativeHeight && (!this.layout_fitWidth || !this.layoutDoc.layout_reflowVertical)) {
@@ -1449,6 +1443,8 @@ export class DocumentView extends DocComponent() {
render() {
TraceMobx();
+ const borderWidth = 50/*Number(StrCast(this.layoutDoc.layout_borderWidth).replace('px', ''))*/;
+ console.log(this._props.PanelWidth(), borderWidth)
const xshift = Math.abs(this.Xshift) <= 0.001 ? this._props.PanelWidth() : undefined;
const yshift = Math.abs(this.Yshift) <= 0.001 ? this._props.PanelHeight() : undefined;
@@ -1468,7 +1464,7 @@ export class DocumentView extends DocComponent() {
style={{
transform: `translate(${this.centeringX}px, ${this.centeringY}px)`,
width: xshift ?? `${this._props.PanelWidth() - this.Xshift * 2}px`,
- height: this._props.forceAutoHeight ? undefined : yshift ?? (this.layout_fitWidth ? `${this.panelHeight}px` : `${(this.effectiveNativeHeight / this.effectiveNativeWidth) * this._props.PanelWidth()}px`),
+ height: this._props.forceAutoHeight ? '1000px' : yshift ?? (this.layout_fitWidth ? `${this.panelHeight + 500}px` : `${(this.effectiveNativeHeight / this.effectiveNativeWidth) * this._props.PanelWidth() + 500}px`),
}}>