Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Jun 1, 2015
2 parents 7400954 + d7d64e8 commit 8558c90
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CacheUMLExplorer",
"version": "0.13.1",
"version": "0.13.2",
"description": "An UML Class explorer for InterSystems Caché",
"directories": {
"test": "test"
Expand Down
1 change: 0 additions & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,5 @@ <h2 id="methodLabel"></h2>
</div>
</div>
</div>
<canvas id="canvas" width="1000px" height="600px"></canvas>
</body>
</html>
23 changes: 13 additions & 10 deletions web/jsLib/ImageExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var enableSVGDownload = function (classView) {
function getSources(doc, emptySvgDeclarationComputed) {

var svgInfo = [],
svgs = doc.querySelectorAll("svg");
svgs = doc.querySelectorAll("#svgContainer > svg");

[].forEach.call(svgs, function (svg) {

Expand Down Expand Up @@ -67,17 +67,15 @@ var enableSVGDownload = function (classView) {

document.getElementById("button.downloadSVG").addEventListener("click", function () {

var emptySvg = window.document.createElementNS(prefix.svg, 'svg'),
emptySvgDeclarationComputed = getComputedStyle(emptySvg),
source = getSources(document, emptySvgDeclarationComputed)[0];

var emptySvg = document.createElementNS(prefix.svg, 'svg');
document.body.appendChild(emptySvg);
var emptySvgDeclarationComputed = getComputedStyle(emptySvg);
var source = getSources(document, emptySvgDeclarationComputed)[0];
var filename = (classView || {}).SELECTED_NAME || "classDiagram";

var img = new Image();
var url = window.URL.createObjectURL(new Blob(source.source, { "type" : 'image/svg+xml;charset=utf-8'/*"text\/xml"*/ }));

var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var url = window.URL.createObjectURL(new Blob(source.source, { "type" : 'image/svg+xml;charset=utf-8' }));
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.setAttribute("width", source.width);
canvas.setAttribute("height", source.height);
document.body.appendChild(canvas);
Expand All @@ -92,6 +90,7 @@ var enableSVGDownload = function (classView) {
a.click();
setTimeout(function () {
a.parentNode.removeChild(a);
document.body.removeChild(emptySvg);
canvas.parentNode.removeChild(canvas);
window.URL.revokeObjectURL(url);
}, 10);
Expand All @@ -110,6 +109,10 @@ var enableSVGDownload = function (classView) {
for (i=0, len=cSSStyleDeclarationComputed.length; i<len; i++) {
key=cSSStyleDeclarationComputed[i];
value=cSSStyleDeclarationComputed.getPropertyValue(key);

// weird fix for weird bug in chrome: css rewrites w/h tag attributes!
if (value === "auto" && (key === "width" || key === "height")) continue;

if (value!==emptySvgDeclarationComputed.getPropertyValue(key)) {
computedStyleStr+=key+":"+value+";";
}
Expand Down

0 comments on commit 8558c90

Please sign in to comment.