diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-07-31 03:39:55 -0400 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-07-31 03:39:55 -0400 |
commit | 7e8778b06dacab6e9e6dedc562c10898f7075a3b (patch) | |
tree | 744d33c145c7325b3785e865517f5add7fb7a857 /src/new_fields/Doc.ts | |
parent | 8a87f7110b56ca96b3960f6fb3917c7ed8c7a814 (diff) | |
parent | b6fa309cea934d250fe992e70e1e268f344659b5 (diff) |
merged with master
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r-- | src/new_fields/Doc.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 59314783b..dab0f9070 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -462,6 +462,19 @@ export namespace Doc { otherdoc.type = DocumentType.TEMPLATE; return otherdoc; } + export function ApplyTemplateTo(templateDoc: Doc, target: Doc, targetData?: Doc) { + let temp = Doc.MakeDelegate(templateDoc); + target.nativeWidth = Doc.GetProto(target).nativeWidth = undefined; + target.nativeHeight = Doc.GetProto(target).nativeHeight = undefined; + target.width = templateDoc.width; + target.height = templateDoc.height; + Doc.GetProto(target).type = DocumentType.TEMPLATE; + if (targetData && targetData.layout === target) { + targetData.layout = temp; + } else { + target.layout = temp; + } + } export function MakeTemplate(fieldTemplate: Doc, metaKey: string, templateDataDoc: Doc) { // move data doc fields to layout doc as needed (nativeWidth/nativeHeight, data, ??) |