From 280c24f1216a532e9f2157e6db0bf8c8030a16f3 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sat, 13 Mar 2021 11:45:52 -0500 Subject: fixed pdf boxes to handle marquee annotation scaling properly. allowed for docFilters to be specific to pdf sidebar. fixed issue with viewTransition remaining set after following link to doc that was in collection but needs to be created. --- src/fields/Doc.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/fields/Doc.ts') diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index e64195b63..e26d771d3 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1063,9 +1063,10 @@ export namespace Doc { // filters document in a container collection: // all documents with the specified value for the specified key are included/excluded // based on the modifiers :"check", "x", undefined - export function setDocFilter(target: Opt, key: string, value: any, modifiers: "remove" | "match" | "check" | "x", toggle?: boolean) { + export function setDocFilter(target: Opt, key: string, value: any, modifiers: "remove" | "match" | "check" | "x", toggle?: boolean, fieldSuffix?:string) { const container = target ?? CollectionDockingView.Instance.props.Document; - const docFilters = Cast(container._docFilters, listSpec("string"), []); + const filterField = "_"+(fieldSuffix ? fieldSuffix+"-":"")+"docFilters"; + const docFilters = Cast(container[filterField], listSpec("string"), []); runInAction(() => { for (let i = 0; i < docFilters.length; i++) { const fields = docFilters[i].split(":"); // split key:value:modifier @@ -1075,15 +1076,15 @@ export namespace Doc { else return; } docFilters.splice(i, 1); - container._docFilters = new List(docFilters); + container[filterField] = new List(docFilters); break; } } if (!docFilters.length && modifiers === "match" && value === undefined) { - container._docFilters = undefined; + container[filterField] = undefined; } else if (modifiers !== "remove") { docFilters.push(key + ":" + value + ":" + modifiers); - container._docFilters = new List(docFilters); + container[filterField] = new List(docFilters); } }); } -- cgit v1.2.3-70-g09d2