diff options
| author | bobzel <zzzman@gmail.com> | 2023-02-22 21:06:34 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2023-02-22 21:06:34 -0500 |
| commit | ac8a292b2ac077cb530b926824594efab2228a16 (patch) | |
| tree | d7509392b2b6b8c2d303c4402ae4882e8ebc796c /src/client/views/collections/collectionFreeForm | |
| parent | b6cab6b3c47751b1d77297b7d150d8f227524592 (diff) | |
fixed hiding doc decorations when clicking on a nested doc. finished removing old view spec code in favor of saving and restoring anchor data.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index d69e6b810..3300bc387 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1592,24 +1592,13 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection } @action - setViewSpec = (anchor: Doc, preview: boolean) => { - if (preview) { - this._focusFilters = StrListCast(Doc.GetProto(anchor).docFilters); - this._focusRangeFilters = StrListCast(Doc.GetProto(anchor).docRangeFilters); - } else { - if (anchor.docFilters) { - this.layoutDoc._docFilters = new List<string>(StrListCast(anchor.docFilters)); - } - if (anchor.docRangeFilters) { - this.layoutDoc._docRangeFilters = new List<string>(StrListCast(anchor.docRangeFilters)); - } - } - return 0; - }; - - @action scrollFocus = (anchor: Doc, options: DocFocusOptions) => { const focusSpeed = options.instant ? 0 : options.zoomTime ?? 500; + if (options.preview) { + this._focusFilters = StrListCast(anchor.presPinDocFilters); + this._focusRangeFilters = StrListCast(anchor.presPinDocRangeFilters); + return undefined; + } return PresBox.restoreTargetDocView( this.props.DocumentView?.(), // { pinDocLayout: BoolCast(anchor.presPinLayout) }, @@ -1618,6 +1607,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection { pannable: anchor.presPinData ? true : false, viewType: anchor.presPinViewType ? true : false, + filters: anchor.presPinDocFilters || anchor.presPinDocRangeFilters ? true : false, } ) ? focusSpeed @@ -1631,9 +1621,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection // create an anchor that saves information about the current state of the freeform view (pan, zoom, view type) const anchor = Docs.Create.TextanchorDocument({ title: 'ViewSpec - ' + StrCast(this.layoutDoc._viewType), presTransition: 500, annotationOn: this.rootDoc }); - PresBox.pinDocView(anchor, { pinData: { pannable: true, viewType: true } }, this.rootDoc); - // bcz TODO: saving document filters should be part of pinDocView... - Doc.GetProto(anchor).docFilters = ObjectField.MakeCopy(this.layoutDoc.docFilters as ObjectField) || new List<string>([]); + PresBox.pinDocView(anchor, { pinData: { pannable: true, viewType: true, filters: true } }, this.rootDoc); if (addAsAnnotation) { if (Cast(this.dataDoc[this.props.fieldKey + '-annotations'], listSpec(Doc), null) !== undefined) { |
