diff options
author | bobzel <zzzman@gmail.com> | 2021-04-01 09:26:16 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-04-01 09:26:16 -0400 |
commit | 0ee4a71ff4706bd957bb001d41b4c02796073615 (patch) | |
tree | 67c2fef14c030e75fb71b411041ddfd5cbb37b70 /src/fields/Doc.ts | |
parent | f16638e372d020b4169f902f9d0538a20df4d4fb (diff) | |
parent | 93439fabb261e421ff43a737488d33aa9247039d (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index d0ccce9cf..5b3e21e34 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -429,6 +429,11 @@ export namespace Doc { index = allowProtos && index !== -1 ? index : list.reduce((p, v, i) => (v instanceof Doc && Doc.AreProtosEqual(v, toFind)) ? i : p, -1); return index; // list.findIndex(doc => doc === toFind || Doc.AreProtosEqual(doc, toFind)); } + + /** + * Removes doc from the list of Docs at listDoc[fieldKey] + * @returns true if successful, false otherwise. + */ export function RemoveDocFromList(listDoc: Doc, fieldKey: string | undefined, doc: Doc) { const key = fieldKey ? fieldKey : Doc.LayoutFieldKey(listDoc); if (listDoc[key] === undefined) { @@ -444,6 +449,11 @@ export namespace Doc { } return false; } + + /** + * Adds doc to the list of Docs stored at listDoc[fieldKey]. + * @returns true if successful, false otherwise. + */ export function AddDocToList(listDoc: Doc, fieldKey: string | undefined, doc: Doc, relativeTo?: Doc, before?: boolean, first?: boolean, allowDuplicates?: boolean, reversed?: boolean) { const key = fieldKey ? fieldKey : Doc.LayoutFieldKey(listDoc); if (listDoc[key] === undefined) { @@ -477,9 +487,9 @@ export namespace Doc { return false; } - // - // Computes the bounds of the contents of a set of documents. - // + /** + * Computes the bounds of the contents of a set of documents. + */ export function ComputeContentBounds(docList: Doc[]) { const bounds = docList.reduce((bounds, doc) => { const [sptX, sptY] = [NumCast(doc.x), NumCast(doc.y)]; |