From baa83eed61a2cf25cd08f2a46e3c506aea173ca5 Mon Sep 17 00:00:00 2001 From: jberg Date: Sat, 14 Sep 2019 19:41:46 -0700 Subject: [PATCH] Fix image lookups for animated layers (#928) --- modern/src/App.js | 6 +++--- modern/src/initialize.js | 3 ++- modern/src/runtime/AnimatedLayer.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modern/src/App.js b/modern/src/App.js index fb5e7782..c05b8d74 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -354,7 +354,7 @@ function animatedLayerOffsetAndSize( function AnimatedLayer({ node, id, - image, + js_assets, x, y, w, @@ -362,12 +362,12 @@ function AnimatedLayer({ framewidth, frameheight, }) { - if (image == null) { + const img = js_assets.image; + if (img == null) { console.warn("Got an AnimatedLayer without an image. Rendering null", id); return null; } - const img = node.js_imageLookup(image.toLowerCase()); const frameNum = node.getcurframe(); let style = {}; diff --git a/modern/src/initialize.js b/modern/src/initialize.js index 42e5494a..762b2529 100644 --- a/modern/src/initialize.js +++ b/modern/src/initialize.js @@ -44,7 +44,8 @@ async function prepareMakiImage(node, zip, file) { function imageAttributesFromNode(node) { if (!node.name) return []; switch (node.name.toLowerCase()) { - case "layer": { + case "layer": + case "animatedlayer": { return ["image"]; } case "layout": { diff --git a/modern/src/runtime/AnimatedLayer.ts b/modern/src/runtime/AnimatedLayer.ts index 599fc19d..ec92fe05 100644 --- a/modern/src/runtime/AnimatedLayer.ts +++ b/modern/src/runtime/AnimatedLayer.ts @@ -55,7 +55,7 @@ class AnimatedLayer extends Layer { return; } - const image = this.js_imageLookup(attributes.image); + const image = attributes.js_assets.image; if (!image) { console.warn("Could not find image: ", attributes.image); return;