diff options
author | Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> | 2020-02-12 17:05:26 -0500 |
---|---|---|
committer | Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> | 2020-02-12 17:05:26 -0500 |
commit | c5b030f9b00fad5b3ee5e34c6d095519084bb2cf (patch) | |
tree | 88ac7e105cfa2a9050e916b8fbffa94ed5ee0ac4 /src/client/documents/Documents.ts | |
parent | 736dde96336c5a00d3761f0894157b51a26081cc (diff) |
added native width and height to imported images
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r-- | src/client/documents/Documents.ts | 10 |
1 files changed, 7 insertions, 3 deletions
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) { |