From 7c83bc30b3a6ed6061ef68bcef6a0e8941668b3c Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 26 Aug 2021 19:17:53 -0400 Subject: fixed resizing bug for web and pdf documents when doing autoheight gesture, and after opening the sidebar and then resizing --- src/client/documents/Documents.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/client/documents') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index db1e67203..a1ffddb98 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -709,10 +709,20 @@ export namespace Docs { } export function PdfDocument(url: string, options: DocumentOptions = {}) { + const width = options._width || undefined; + const height = options._height || undefined; + const nwid = options._nativeWidth || undefined; + const nhght = options._nativeHeight || undefined; + if (!nhght && width && height && nwid) options._nativeHeight = Number(nwid) * Number(height) / Number(width); return InstanceFromProto(Prototypes.get(DocumentType.PDF), new PdfField(url), options); } export function WebDocument(url: string, options: DocumentOptions = {}) { + const width = options._width || undefined; + const height = options._height || undefined; + const nwid = options._nativeWidth || undefined; + const nhght = options._nativeHeight || undefined; + if (!nhght && width && height && nwid) options._nativeHeight = Number(nwid) * Number(height) / Number(width); return InstanceFromProto(Prototypes.get(DocumentType.WEB), url ? new WebField(url) : undefined, options); } -- cgit v1.2.3-70-g09d2