aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionTimeView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-02-27 15:08:45 -0500
committerbobzel <zzzman@gmail.com>2023-02-27 15:08:45 -0500
commitaf2a2c83868c87812e9ae54c8e3cced81374619a (patch)
treedaa3f79b93c22f9c0f90b00c2e6f843de6eedc36 /src/client/views/collections/CollectionTimeView.tsx
parent536e1ed3f847b0e7343c1cf9eb7fc0c97818e171 (diff)
restructured getAnchor()/scrollFocus to be more consistent. added setterscript for computedFields. restructed getFieldsImpl to avoid making multiple requests for the same document due to timing issues by 'locking' a document cache with a promise before sending the server request. added rotation and fill color as animatable fields. fixed image cropping for
Diffstat (limited to 'src/client/views/collections/CollectionTimeView.tsx')
-rw-r--r--src/client/views/collections/CollectionTimeView.tsx37
1 files changed, 8 insertions, 29 deletions
diff --git a/src/client/views/collections/CollectionTimeView.tsx b/src/client/views/collections/CollectionTimeView.tsx
index e6f29ec37..437b22040 100644
--- a/src/client/views/collections/CollectionTimeView.tsx
+++ b/src/client/views/collections/CollectionTimeView.tsx
@@ -21,7 +21,7 @@ import { CollectionFreeFormView } from './collectionFreeForm/CollectionFreeFormV
import { CollectionSubView } from './CollectionSubView';
import './CollectionTimeView.scss';
import React = require('react');
-import { DocFocusOptions } from '../nodes/DocumentView';
+import { DocFocusOptions, DocumentView } from '../nodes/DocumentView';
import { PresBox } from '../nodes/trails';
@observer
@@ -52,8 +52,7 @@ export class CollectionTimeView extends CollectionSubView() {
title: ComputedField.MakeFunction(`"${this.pivotField}"])`) as any,
annotationOn: this.rootDoc,
});
- anchor.presPinPivotField = this.pivotField; // should be captured in pinDocView below
- PresBox.pinDocView(anchor, { pinData: { viewType: true, filters: true } }, this.rootDoc);
+ PresBox.pinDocView(anchor, { pinData: { viewType: true, pivot: true, filters: true } }, this.rootDoc);
if (addAsAnnotation) {
// when added as an annotation, links to anchors can be found as links to the document even if the anchors are not rendered
@@ -67,32 +66,12 @@ export class CollectionTimeView extends CollectionSubView() {
};
@action
- scrollFocus = (anchor: Doc, options: DocFocusOptions) => {
- if (options.preview) {
- // if in preview, then override document's fields with view spec
- this._focusFilters = StrListCast(anchor.presPinDocFilters);
- this._focusRangeFilters = StrListCast(anchor.presPinDocRangeFilters);
- this._focusPivotField = StrCast(anchor.presPinPivotField);
- return undefined;
- }
- const focusSpeed = options.instant ? 0 : options.zoomTime ?? 500;
-
- // should be part of restoreTargetDocView
- this.layoutDoc._prevFilterIndex = 1;
- this.layoutDoc._pivotField = anchor.presPinPivotField;
-
- return PresBox.restoreTargetDocView(
- this.props.DocumentView?.(), //
- { pinDocLayout: BoolCast(anchor.presPinLayout) },
- anchor,
- focusSpeed,
- {
- viewType: anchor.presPinViewType ? true : false,
- filters: anchor.presPinDocFilters || anchor.presPinDocRangeFilters ? true : false,
- }
- )
- ? focusSpeed
- : undefined;
+ scrollPreview = (docView: DocumentView, anchor: Doc, options: DocFocusOptions) => {
+ // if in preview, then override document's fields with view spec
+ this._focusFilters = StrListCast(anchor.presPinDocFilters);
+ this._focusRangeFilters = StrListCast(anchor.presPinDocRangeFilters);
+ this._focusPivotField = StrCast(anchor.presPinPivotField);
+ return undefined;
};
layoutEngine = () => this._layoutEngine;