aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/CollectionFreeFormDocumentView.tsx')
-rw-r--r--src/client/views/nodes/CollectionFreeFormDocumentView.tsx56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index d6f8ce19c..c87239ee9 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -16,7 +16,7 @@ import { ComputedField } from "../../../fields/ScriptField";
import { listSpec } from "../../../fields/Schema";
import { DocumentType } from "../../documents/DocumentTypes";
import { Zoom, Fade, Flip, Rotate, Bounce, Roll, LightSpeed } from 'react-reveal';
-import { PresBox } from "./PresBox";
+import { PresBox, PresEffect } from "./PresBox";
import { InkingStroke } from "../InkingStroke";
export interface CollectionFreeFormDocumentViewProps extends DocumentViewProps {
@@ -55,8 +55,8 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
@computed get freezeDimensions() { return this.props.FreezeDimensions; }
@computed get dataProvider() { return this.props.dataProvider?.(this.props.Document, this.props.replica); }
@computed get sizeProvider() { return this.props.sizeProvider?.(this.props.Document, this.props.replica); }
- @computed get nativeWidth() { return returnVal(this.props.NativeWidth?.(), NumCast(this.layoutDoc._nativeWidth, this.freezeDimensions ? this.layoutDoc[WidthSym]() : 0)); }
- @computed get nativeHeight() { return returnVal(this.props.NativeHeight?.(), NumCast(this.layoutDoc._nativeHeight, this.freezeDimensions ? this.layoutDoc[HeightSym]() : 0)); }
+ @computed get nativeWidth() { return returnVal(this.props.NativeWidth?.(), Doc.NativeWidth(this.layoutDoc, undefined, this.freezeDimensions)); }
+ @computed get nativeHeight() { return returnVal(this.props.NativeHeight?.(), Doc.NativeHeight(this.layoutDoc, undefined, this.freezeDimensions)); }
public static getValues(doc: Doc, time: number) {
const timecode = Math.round(time);
@@ -65,7 +65,7 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
w: Cast(doc["w-indexed"], listSpec("number"), [NumCast(doc._width)]).reduce((p, w, i) => (i <= timecode && w !== undefined) || p === undefined ? w : p, undefined as any as number),
x: Cast(doc["x-indexed"], listSpec("number"), [NumCast(doc.x)]).reduce((p, x, i) => (i <= timecode && x !== undefined) || p === undefined ? x : p, undefined as any as number),
y: Cast(doc["y-indexed"], listSpec("number"), [NumCast(doc.y)]).reduce((p, y, i) => (i <= timecode && y !== undefined) || p === undefined ? y : p, undefined as any as number),
- scroll: Cast(doc["scroll-indexed"], listSpec("number"), [NumCast(doc._scrollY, 0)]).reduce((p, s, i) => (i <= timecode && s !== undefined) || p === undefined ? s : p, undefined as any as number),
+ scroll: Cast(doc["scroll-indexed"], listSpec("number"), [NumCast(doc._scrollTop, 0)]).reduce((p, s, i) => (i <= timecode && s !== undefined) || p === undefined ? s : p, undefined as any as number),
opacity: Cast(doc["opacity-indexed"], listSpec("number"), [NumCast(doc.opacity, 1)]).reduce((p, o, i) => i <= timecode || p === undefined ? o : p, undefined as any as number),
});
}
@@ -97,24 +97,24 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
d["text-color"] = "grey";
} else { d["text-color"] = "black"; }
} else if (d.appearFrame === 0) {
- d["text-color"] = "black";
}
}
- public static updateScrollframe(doc: Doc, time: number) {
- const timecode = Math.round(time);
- const scrollIndexed = Cast(doc['scroll-indexed'], listSpec("number"), null);
- scrollIndexed?.length <= timecode + 1 && scrollIndexed.push(undefined as any as number);
- setTimeout(() => doc.dataTransition = "inherit", 1010);
- }
+ // public static updateScrollframe(doc: Doc, time: number) {
+ // console.log('update scroll frame');
+ // const timecode = Math.round(time);
+ // const scrollIndexed = Cast(doc['scroll-indexed'], listSpec("number"), null);
+ // scrollIndexed?.length <= timecode + 1 && scrollIndexed.push(undefined as any as number);
+ // setTimeout(() => doc.dataTransition = "inherit", 1010);
+ // }
- public static setupScroll(doc: Doc, timecode: number) {
- const scrollList = new List<number>();
- scrollList[timecode] = NumCast(doc._scrollY);
- doc["scroll-indexed"] = scrollList;
- doc.activeFrame = ComputedField.MakeFunction("self._currentFrame");
- doc._scrollY = ComputedField.MakeInterpolated("scroll", "activeFrame");
- }
+ // public static setupScroll(doc: Doc, timecode: number) {
+ // const scrollList = new List<number>();
+ // scrollList[timecode] = NumCast(doc._scrollTop);
+ // doc["scroll-indexed"] = scrollList;
+ // doc.activeFrame = ComputedField.MakeFunction("self._currentFrame");
+ // doc._scrollTop = ComputedField.MakeInterpolated("scroll", "activeFrame");
+ // }
public static updateKeyframe(docs: Doc[], time: number, targetDoc?: Doc) {
@@ -212,23 +212,23 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
PanelHeight={this.panelHeight} />;
if (PresBox.Instance && this.layoutDoc === PresBox.Instance.childDocs[PresBox.Instance.itemIndex]?.presentationTargetDoc) {
const effectProps = {
- left: this.layoutDoc.presEffectDirection === 'left',
- right: this.layoutDoc.presEffectDirection === 'right',
- top: this.layoutDoc.presEffectDirection === 'top',
- bottom: this.layoutDoc.presEffectDirection === 'bottom',
+ left: this.layoutDoc.presEffectDirection === PresEffect.Left,
+ right: this.layoutDoc.presEffectDirection === PresEffect.Right,
+ top: this.layoutDoc.presEffectDirection === PresEffect.Top,
+ bottom: this.layoutDoc.presEffectDirection === PresEffect.Bottom,
opposite: true,
delay: this.layoutDoc.presTransition,
// when: this.layoutDoc === PresBox.Instance.childDocs[PresBox.Instance.itemIndex]?.presentationTargetDoc,
};
switch (this.layoutDoc.presEffect) {
case "Zoom": return (<Zoom {...effectProps}>{node}</Zoom>); break;
- case "Fade": return (<Fade {...effectProps}>{node}</Fade>); break;
- case "Flip": return (<Flip {...effectProps}>{node}</Flip>); break;
- case "Rotate": return (<Rotate {...effectProps}>{node}</Rotate>); break;
- case "Bounce": return (<Bounce {...effectProps}>{node}</Bounce>); break;
- case "Roll": return (<Roll {...effectProps}>{node}</Roll>); break;
+ case PresEffect.Fade: return (<Fade {...effectProps}>{node}</Fade>); break;
+ case PresEffect.Flip: return (<Flip {...effectProps}>{node}</Flip>); break;
+ case PresEffect.Rotate: return (<Rotate {...effectProps}>{node}</Rotate>); break;
+ case PresEffect.Bounce: return (<Bounce {...effectProps}>{node}</Bounce>); break;
+ case PresEffect.Roll: return (<Roll {...effectProps}>{node}</Roll>); break;
case "LightSpeed": return (<LightSpeed {...effectProps}>{node}</LightSpeed>); break;
- case "None": return node; break;
+ case PresEffect.None: return node; break;
default: return node; break;
}
} else {