aboutsummaryrefslogtreecommitdiff
path: root/src/fields
diff options
context:
space:
mode:
authorMelissa Zhang <mzhang19096@gmail.com>2020-05-20 23:19:14 -0700
committerMelissa Zhang <mzhang19096@gmail.com>2020-05-20 23:19:14 -0700
commit905176166a4b33dfbf3c7ac1640381cea53485b6 (patch)
treee5f4eb058d5d7e5a5d84e2a8fedbd154486db07d /src/fields
parent07566108db7da0a8e30dcb4c6b884482b57394a1 (diff)
parent45386f6950e5ae8390486900a430061bfe9e4846 (diff)
merge with master
Diffstat (limited to 'src/fields')
-rw-r--r--src/fields/Doc.ts2
-rw-r--r--src/fields/ScriptField.ts8
-rw-r--r--src/fields/documentSchemas.ts6
3 files changed, 8 insertions, 8 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index a1e1e11b1..9f38f4369 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -574,7 +574,7 @@ export namespace Doc {
if (field instanceof RefField) {
copy[key] = field;
} else if (cfield instanceof ComputedField) {
- copy[key] = ComputedField.MakeFunction(cfield.script.originalScript);
+ copy[key] = cfield[Copy]();// ComputedField.MakeFunction(cfield.script.originalScript);
} else if (field instanceof ObjectField) {
copy[key] = doc[key] instanceof Doc ?
key.includes("layout[") ? Doc.MakeCopy(doc[key] as Doc, false) : doc[key] : // reference documents except copy documents that are expanded teplate fields
diff --git a/src/fields/ScriptField.ts b/src/fields/ScriptField.ts
index 0ac1ac360..503c60790 100644
--- a/src/fields/ScriptField.ts
+++ b/src/fields/ScriptField.ts
@@ -140,10 +140,8 @@ export class ComputedField extends ScriptField {
_valueOutsideReaction = (doc: Doc) => this._lastComputedResult = this.script.run({ this: doc, self: Cast(doc.rootDocument, Doc, null) || doc, _last_: this._lastComputedResult }, console.log).result;
- constructor(script: CompiledScript, setterscript?: CompiledScript) {
- super(script,
- !setterscript && script?.originalScript.includes("self.timecode") ?
- ScriptField.CompileScript("self['x' + self.timecode] = value", { value: "any" }, true) : setterscript);
+ [Copy](): ObjectField {
+ return new ComputedField(this.script);
}
public static MakeScript(script: string, params: object = {}) {
@@ -163,7 +161,7 @@ export class ComputedField extends ScriptField {
}
Scripting.addGlobal(function getIndexVal(list: any[], index: number) {
- return list.reduce((p, x, i) => (i <= index && x !== undefined) || p === undefined ? x : p, undefined as any)
+ return list.reduce((p, x, i) => (i <= index && x !== undefined) || p === undefined ? x : p, undefined as any);
});
export namespace ComputedField {
diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts
index cacba43b6..142f7e079 100644
--- a/src/fields/documentSchemas.ts
+++ b/src/fields/documentSchemas.ts
@@ -20,7 +20,9 @@ export const documentSchema = createSchema({
z: "number", // z "coordinate" - non-zero specifies the overlay layer of a freeformview
zIndex: "number", // zIndex of a document in a freeform view
scrollY: "number", // "command" to scroll a document to a position on load (the value will be reset to 0 after that )
+ scrollX: "number", // "command" to scroll a document to a position on load (the value will be reset to 0 after that )
scrollTop: "number", // scroll position of a scrollable document (pdf, text, web)
+ scrollLeft: "number", // scroll position of a scrollable document (pdf, text, web)
// appearance properties on the layout
_autoHeight: "boolean", // whether the height of the document should be computed automatically based on its contents
@@ -74,8 +76,8 @@ export const documentSchema = createSchema({
isLinkButton: "boolean", // whether document functions as a link follow button to follow the first link on the document when clicked
isBackground: "boolean", // whether document is a background element and ignores input events (can only select with marquee)
lockedPosition: "boolean", // whether the document can be moved (dragged)
- lockedTransform: "boolean", // whether the document can be panned/zoomed
-
+ _lockedTransform: "boolean",// whether a freeformview can pan/zoom
+
// drag drop properties
dragFactory: Doc, // the document that serves as the "template" for the onDragStart script. ie, to drag out copies of the dragFactory document.
dropAction: "string", // override specifying what should happen when this document is dropped (can be "alias", "copy", "move")