aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocComponent.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-04-09 18:27:51 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-04-09 18:27:51 -0400
commitae64711a1bcfc35c9ca0c86d99c99962642c9b09 (patch)
treebe26475ec799139fd1f9c374ab0c8d604a02bbfa /src/client/views/DocComponent.tsx
parent8bca5882b39c21560c29cb97c2770a7a78384018 (diff)
fixed links to have a timecode again. updated a bunch of this.Document calls to this.layoutDoc, this.dataDoc, etc
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r--src/client/views/DocComponent.tsx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 325f7c042..d08065820 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -5,7 +5,6 @@ import { Cast } from '../../new_fields/Types';
import { listSpec } from '../../new_fields/Schema';
import { InkingControl } from './InkingControl';
import { InkTool } from '../../new_fields/InkField';
-import { PositionDocument } from '../../new_fields/documentSchemas';
import { InteractionUtils } from '../util/InteractionUtils';
@@ -22,6 +21,9 @@ export function DocComponent<P extends DocComponentProps, T>(schemaCtor: (doc: D
@computed get rootDoc() { return Cast(this.props.Document.rootDocument, Doc, null) || this.props.Document; }
// This is the rendering data of a document -- it may be "The Document", or it may be some template document that holds the rendering info
@computed get layoutDoc() { return Doc.Layout(this.props.Document); }
+ // This is the data part of a document -- ie, the data that is constant across all views of the document
+ @computed get dataDoc() { return this.props.Document[DataSym]; }
+
protected multiTouchDisposer?: InteractionUtils.MultiTouchEventDisposer;
}
return Component;
@@ -39,7 +41,8 @@ interface DocExtendableProps {
export function DocExtendableComponent<P extends DocExtendableProps, T>(schemaCtor: (doc: Doc) => T) {
class Component extends Touchable<P> {
//TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
- @computed get Document(): T { return schemaCtor(this.props.Document); }
+ //@computed get Document(): T { return schemaCtor(this.props.Document); }
+
// This is the "The Document" -- it encapsulates, data, layout, and any templates
@computed get rootDoc() { return Cast(this.props.Document.rootDocument, Doc, null) || this.props.Document; }
// This is the rendering data of a document -- it may be "The Document", or it may be some template document that holds the rendering info
@@ -47,6 +50,9 @@ export function DocExtendableComponent<P extends DocExtendableProps, T>(schemaCt
// This is the data part of a document -- ie, the data that is constant across all views of the document
@computed get dataDoc() { return this.props.DataDoc && (this.props.Document.isTemplateForField || this.props.Document.isTemplateDoc) ? this.props.DataDoc : this.props.Document[DataSym]; }
+ // key where data is stored
+ @computed get fieldKey() { return this.props.fieldKey; }
+
active = (outsideReaction?: boolean) => !this.props.Document.isBackground && ((this.props.Document.forceActive && this.props.rootSelected(outsideReaction)) || this.props.isSelected(outsideReaction) || this.props.renderDepth === 0);// && !InkingControl.Instance.selectedTool; // bcz: inking state shouldn't affect static tools
protected multiTouchDisposer?: InteractionUtils.MultiTouchEventDisposer;
}
@@ -79,7 +85,7 @@ export function DocAnnotatableComponent<P extends DocAnnotatableProps, T>(schema
@computed get dataDoc() { return this.props.DataDoc && (this.props.Document.isTemplateForField || this.props.Document.isTemplateDoc) ? this.props.DataDoc : this.props.Document[DataSym]; }
// key where data is stored
- @computed get fieldKey() { return this.props.fieldKey; }
+ @computed get fieldKey() { return this.props.fieldKey; }
protected multiTouchDisposer?: InteractionUtils.MultiTouchEventDisposer;