diff options
author | bob <bcz@cs.brown.edu> | 2019-07-11 16:05:50 -0400 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-07-11 16:05:50 -0400 |
commit | 348cedb4db1426f4bac8f0ff4e136f329983f7c1 (patch) | |
tree | 3d6bbe3a0d4d0886ba5ee56efff88d220945962f /src/new_fields/Doc.ts | |
parent | 36992ca2388e2a6919ecf0b78f4731bc9aea8f86 (diff) | |
parent | b4350c48aee6474692330761f96f8d93bfd4b2da (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
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"); |