From c5b030f9b00fad5b3ee5e34c6d095519084bb2cf Mon Sep 17 00:00:00 2001 From: Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> Date: Wed, 12 Feb 2020 17:05:26 -0500 Subject: added native width and height to imported images --- src/client/documents/Documents.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/client') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 24dd9ae91..86f68e883 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -367,11 +367,15 @@ export namespace Docs { const { __images } = device; delete device.__images; const { ImageDocument, StackingDocument } = Docs.Create; - const constructed = __images.map(relative => Utils.prepend(relative)); - const deviceImages = constructed.map((url, i) => ImageDocument(url, { title: `image${i}.${extname(url)}` })); + const constructed = __images.map(({ url, nativeWidth, nativeHeight }) => ({ url: Utils.prepend(url), nativeWidth, nativeHeight })); + const deviceImages = constructed.map(({ url, nativeWidth, nativeHeight }, i) => ImageDocument(url, { + title: `image${i}.${extname(url)}`, + _nativeWidth: nativeWidth, + _nativeHeight: nativeHeight + })); const doc = StackingDocument(deviceImages, { title: device.title, _LODdisable: true }); const deviceProto = Doc.GetProto(doc); - deviceProto.hero = new ImageField(constructed[0]); + deviceProto.hero = new ImageField(constructed[0].url); Docs.Get.DocumentHierarchyFromJson(device, undefined, deviceProto); Doc.AddDocToList(parentProto, "data", doc); } else if (errors) { -- cgit v1.2.3-70-g09d2