Use real width of SVGs for translation in editor

This commit is contained in:
Adam Goldsmith 2017-09-28 12:57:23 -04:00
parent ed2d7092ae
commit 4d7a2d7172

View File

@ -13,7 +13,8 @@ window.addEventListener("load", () => {
document.body.appendChild(newSvg); document.body.appendChild(newSvg);
deckJSON.deck.forEach((card, index) => { deckJSON.deck.forEach((card, index) => {
let cardSVG = respSVG.cloneNode(true); 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); newSvg.appendChild(cardSVG);
for (let prop in card) { for (let prop in card) {
if (prop !== "count") { if (prop !== "count") {