From 416115f2af2e160b1af327f543c4ba69695cf2f0 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Tue, 4 Apr 2017 22:31:25 -0700 Subject: [PATCH 1/2] fix scaling --- ecosystem.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ecosystem.js b/ecosystem.js index da36928..a4e1459 100644 --- a/ecosystem.js +++ b/ecosystem.js @@ -163,11 +163,11 @@ var Ecosystem = { } } - var svgContainer = document.getElementById(paperlabel); + var svg = document.getElementById(paperlabel).firstChild; var scaleFactor = (scaleFactor == null) ? 1 : scaleFactor; - svgContainer.setAttribute("width", (scaleFactor*250).toString() + "px"); - svgContainer.setAttribute("height", (scaleFactor*250).toString() + "px"); - svgContainer.setAttribute("viewBox", "0 0 250 250"); + svg.setAttribute("width", (scaleFactor*250).toString() + "px"); + svg.setAttribute("height", (scaleFactor*250).toString() + "px"); + svg.setAttribute("viewBox", "0 0 250 250"); } return { From d1bffc7298aa20c36f70675b1f9d49f29bc92fc3 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Mon, 1 May 2017 17:06:16 -0700 Subject: [PATCH 2/2] don't add unique() to array prototype it's bad form (and can cause bugs) to change the built-in prototypes --- ecosystem.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ecosystem.js b/ecosystem.js index a4e1459..5109b0c 100644 --- a/ecosystem.js +++ b/ecosystem.js @@ -1,12 +1,5 @@ function rm(v, item) {if (v.indexOf(item) > -1) { v.splice(v.indexOf(item), 1); }} -Array.prototype.unique = function() { - var o = {}, i, l = this.length, r = []; - for(i=0; i