diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c28d72..94315d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ p5.svg@0.5.0 (requires p5.js@0.4.8) - add p5.prototype.registerSVGFilter -- add p5.prototype.getSerializedSVG +- add p5.prototype.getDataURL ## v0.4.3 diff --git a/dist/p5.svg.js b/dist/p5.svg.js index 64bccb6..66e4a5d 100644 --- a/dist/p5.svg.js +++ b/dist/p5.svg.js @@ -2025,13 +2025,16 @@ module.exports = function(p5) { // so that it won't make preload mess setTimeout(function() { if (path.indexOf(';base64,') > -1) { - successCallback(atob(svg)); + svg = atob(svg); } else { - successCallback(decodeURIComponent(svg)); + svg = decodeURIComponent(svg); } + successCallback(svg); }, 1); + return svg; } else { this.httpGet(path, successCallback); + return null; } }; @@ -2064,7 +2067,7 @@ module.exports = function(p5) { // cause preload to wait p5.prototype._preloadMethods.loadSVG = p5.prototype; - p5.prototype.getSerializedSVG = function() { + p5.prototype.getDataURL = function() { return this._graphics.elt.toDataURL('image/svg+xml'); }; }; @@ -2187,9 +2190,9 @@ module.exports = function(p5) { } this._setGCFlag(element); var g = this.drawingContext.__closestGroupOrSvg(); - console.log(g, element); g.appendChild(element); - console.log(g); + // window.g = g; + // window.x = element; }; /** diff --git a/doc/reference/RendererSVG.html b/doc/reference/RendererSVG.html index c1fc90b..318a04f 100644 --- a/doc/reference/RendererSVG.html +++ b/doc/reference/RendererSVG.html @@ -616,7 +616,7 @@