From 1e00b7680c87b51324a0e846d32dd8c62198aa4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Thu, 4 Oct 2018 16:58:19 -0500 Subject: [PATCH] Fixes meme creator, whoops --- app/components/client/playground-scripts.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/components/client/playground-scripts.js b/app/components/client/playground-scripts.js index c5ffa9b..4fab7d3 100644 --- a/app/components/client/playground-scripts.js +++ b/app/components/client/playground-scripts.js @@ -21,14 +21,14 @@ document.querySelector("body").addEventListener("click", event => { } if ( - event.explicitOriginalTarget.classList && - event.explicitOriginalTarget.classList[0] === "playground__content__meme__canvas__thumbnail" + event.target.classList && + event.target.classList[0] === "playground__content__meme__canvas__thumbnail" ) { for (const thumbnail of document.querySelectorAll(".playground__content__meme__canvas__thumbnail")) thumbnail.classList.remove("selected"); - event.explicitOriginalTarget.classList.add("selected"); - updateCanvas(event.explicitOriginalTarget); + event.target.classList.add("selected"); + updateCanvas(event.target); } }); @@ -377,10 +377,10 @@ function updateCanvas(imageSource) { clearCanvas(canvas); if (imageSource) { - ctx.drawImage(imageSource, 0, 0, canvasWidth, 600 * imageSource.height / imageSource.width); + ctx.drawImage(imageSource, 0, 0, canvasWidth, canvasHeight); img.src = imageSource.src; } else { - ctx.drawImage(imageSource, 0, 0, canvasWidth, 600 * imageSource.height / imageSource.width); + ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight); } positionCanvasText(ctx, canvasHeight, canvasWidth);