From c577e1c8722cf3399305b08ad2ed1d35e804b710 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 28 Sep 2017 12:57:23 -0400 Subject: [PATCH] Use real width of SVGs for translation in editor --- js/editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/editor.js b/js/editor.js index dcb50d7..858f185 100644 --- a/js/editor.js +++ b/js/editor.js @@ -13,7 +13,8 @@ window.addEventListener("load", () => { document.body.appendChild(newSvg); deckJSON.deck.forEach((card, index) => { let cardSVG = respSVG.cloneNode(true); - cardSVG.setAttributeNS("http://www.w3.org/2000/svg", "x", index*181 + "pt"); + let width = cardSVG.getAttribute("svg:width"); + cardSVG.setAttribute("svg:x", index * width + "pt"); newSvg.appendChild(cardSVG); for (let prop in card) { if (prop !== "count") {