diff options
author | bobzel <zzzman@gmail.com> | 2019-07-11 15:48:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 15:48:19 -0400 |
commit | b4350c48aee6474692330761f96f8d93bfd4b2da (patch) | |
tree | 2e5048b21a3360faeaf74b6609b58083f496cd88 /src/new_fields/Doc.ts | |
parent | 7006f67b7cf15734fb0b63d917ae392758704f75 (diff) | |
parent | 1b203afbd297f8ae9400a47c9379df912f9ef3b5 (diff) |
Merge pull request #201 from browngraphicslab/extensionFields
Extension fields
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r-- | src/new_fields/Doc.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 3d46243e0..d28a29e40 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -264,8 +264,11 @@ export namespace Doc { return true; } - export function ComputeContentBounds(doc: Doc) { - let bounds = DocListCast(doc.data).reduce((bounds, doc) => { + // + // Computes the bounds of the contents of a set of documents. + // + export function ComputeContentBounds(docList: Doc[]) { + let bounds = docList.reduce((bounds, doc) => { var [sptX, sptY] = [NumCast(doc.x), NumCast(doc.y)]; let [bptX, bptY] = [sptX + doc[WidthSym](), sptY + doc[HeightSym]()]; return { @@ -372,7 +375,7 @@ export namespace Doc { } let layout = StrCast(fieldLayoutDoc.layout).replace(/fieldKey={"[^"]*"}/, `fieldKey={"${metaKey}"}`); if (backgroundLayout) { - layout = StrCast(fieldLayoutDoc.layout).replace(/fieldKey={"annotations"}/, `fieldKey={"${metaKey}"} fieldExt={"annotations"}`); + layout = StrCast(fieldLayoutDoc.layout).replace(/fieldKey={"[^"]*"}/, `fieldKey={"${metaKey}"} fieldExt={"annotations"}`); backgroundLayout = backgroundLayout.replace(/fieldKey={"[^"]*"}/, `fieldKey={"${metaKey}"}`); } let nw = Cast(fieldTemplate.nativeWidth, "number"); |