aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-08-07 23:30:30 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-08-07 23:30:30 -0400
commit1d770231e7ae6ab2dba7983eb55481e1dd77d42a (patch)
tree873ec56c3c676e7cd4117b8f69b5d09afe869f59 /src/new_fields/Doc.ts
parent87276c9f0698b839089f34432763463d46eec60b (diff)
parentd93219266fe09aefec5bf82808ea286ad6ea3710 (diff)
Merge branch 'pdfAnnotations'
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index ebe3a5ba8..736e8e69d 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -566,4 +566,22 @@ export namespace Doc {
}
});
}
+
+ export class DocBrush {
+ @observable BrushedDoc: Doc[] = [];
+ }
+ const manager = new DocBrush();
+ export function IsBrushed(doc: Doc) {
+ return manager.BrushedDoc.some(d => Doc.AreProtosEqual(d, doc));
+ }
+ export function IsBrushedDegree(doc: Doc) {
+ return manager.BrushedDoc.some(d => d === doc) ? 2 : Doc.IsBrushed(doc) ? 1 : 0;
+ }
+ export function BrushDoc(doc: Doc) {
+ if (manager.BrushedDoc.indexOf(doc) === -1) runInAction(() => manager.BrushedDoc.push(doc));
+ }
+ export function UnBrushDoc(doc: Doc) {
+ let index = manager.BrushedDoc.indexOf(doc);
+ if (index !== -1) runInAction(() => manager.BrushedDoc.splice(index, 1));
+ }
} \ No newline at end of file