added aspect racio governance and generator tags to trails SVGs

pull/89/head
jmoenig 2019-12-02 16:53:44 +01:00
rodzic 391be73691
commit 6d5ddad06c
2 zmienionych plików z 5 dodań i 10 usunięć

Wyświetl plik

@ -13,6 +13,7 @@
* objects: export pen trails as SVG (under construction)
* threads: new "pen trails (SVG)" reporter (experimental, hidden in dev)
* objects, threads: adjusted rotation center of SVG-pen-trails
* objects: added aspect racio governance and generator tags to trails SVGs
## v5.3.8:
* **Notable Change:**

Wyświetl plik

@ -8953,19 +8953,13 @@ StageMorph.prototype.trailsLogAsSVG = function () { // +++
});
box = bottomLeft.corner(topRight).expandBy(maxWidth / 2);
shift = new Point(-bottomLeft.x, topRight.y).translateBy(maxWidth / 2);
svg = '<svg ' +
svg = '<svg xmlns="http://www.w3.org/2000/svg" ' +
'preserveAspectRatio="none" ' +
'viewBox="0 0 ' + box.width() + ' ' + box.height() + '" ' +
'width="' + box.width() + '" height="' + box.height() + '" ' +
// 'style="background-color:black" ' + // for supporting backgrounds
'xmlns="http://www.w3.org/2000/svg">';
// to do:
// * add source comment ("exported from Snap! etc."
// * add "keep aspect ratio" governance
// * catch / disable if the trails log is empty
// * catch if the trails contain non-vectorizable elements (stamp, fill)
// * decide how to handle background colors
// * consider a logging limit to prevent an overflowing queue
'>';
svg += '<!-- Generated by Snap! - http://snap.berkeley.edu/ -->';
// for debugging the viewBox:
// svg += '<rect width="100%" height="100%" fill="black"/>'