Fix spacing

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2800 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-04-08 13:49:58 +00:00
parent 75928e9b63
commit 35ab5a9862
1 changed files with 60 additions and 60 deletions

View File

@ -1069,37 +1069,37 @@ TODOS
} }
}; };
// Export global for use by jsPDF // Export global for use by jsPDF
saveAs = function (blob, options) { saveAs = function (blob, options) {
var blobUrl = URL.createObjectURL(blob); var blobUrl = URL.createObjectURL(blob);
try { try {
// This creates a bookmarkable data URL, // This creates a bookmarkable data URL,
// but it doesn't currently work in // but it doesn't currently work in
// Firefox, and although it works in Chrome, // Firefox, and although it works in Chrome,
// Chrome doesn't make the full "data:" URL // Chrome doesn't make the full "data:" URL
// visible unless you right-click to "Inspect // visible unless you right-click to "Inspect
// element" and then right-click on the element // element" and then right-click on the element
// to "Copy link address". // to "Copy link address".
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.responseType = 'blob'; xhr.responseType = 'blob';
xhr.onload = function() { xhr.onload = function() {
var recoveredBlob = xhr.response; var recoveredBlob = xhr.response;
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function() { reader.onload = function() {
var blobAsDataUrl = reader.result; var blobAsDataUrl = reader.result;
exportWindow.location.href = blobAsDataUrl; exportWindow.location.href = blobAsDataUrl;
}; };
reader.readAsDataURL(recoveredBlob); reader.readAsDataURL(recoveredBlob);
}; };
xhr.open('GET', blobUrl); xhr.open('GET', blobUrl);
xhr.send(); xhr.send();
} }
catch (e) { catch (e) {
exportWindow.location.href = blobUrl; exportWindow.location.href = blobUrl;
} }
}; };
var exportHandler = function(win, data) { var exportHandler = function(win, data) {
var issues = data.issues, var issues = data.issues,
type = data.type || 'PNG', type = data.type || 'PNG',
dataURLType = (type === 'ICO' ? 'BMP' : type).toLowerCase(); dataURLType = (type === 'ICO' ? 'BMP' : type).toLowerCase();
@ -1108,23 +1108,23 @@ TODOS
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body'); $('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
} }
var c = $('#export_canvas')[0]; var c = $('#export_canvas')[0];
if (type === 'PDF') { if (type === 'PDF') {
var res = svgCanvas.getResolution(); var res = svgCanvas.getResolution();
var orientation = res.w > res.h ? 'landscape' : 'portrait'; var orientation = res.w > res.h ? 'landscape' : 'portrait';
var units = 'pt'; // curConfig.baseUnit; // We could use baseUnit, but that is presumably not intended for export purposes var units = 'pt'; // curConfig.baseUnit; // We could use baseUnit, but that is presumably not intended for export purposes
var doc = new jsPDF(orientation, units, [res.w, res.h]); // Todo: Give options to use predefined jsPDF formats like "a4", etc. from pull-down (with option to keep customizable) var doc = new jsPDF(orientation, units, [res.w, res.h]); // Todo: Give options to use predefined jsPDF formats like "a4", etc. from pull-down (with option to keep customizable)
var docTitle = svgCanvas.getDocumentTitle(); var docTitle = svgCanvas.getDocumentTitle();
doc.setProperties({ doc.setProperties({
title: docTitle/*, title: docTitle/*,
subject: '', subject: '',
author: '', author: '',
keywords: '', keywords: '',
creator: ''*/ creator: ''*/
}); });
svgElementToPdf(data.svg, doc, {}); svgElementToPdf(data.svg, doc, {});
doc.save(docTitle + '.pdf'); doc.save(docTitle + '.pdf');
return; return;
} }
c.width = svgCanvas.contentW; c.width = svgCanvas.contentW;
c.height = svgCanvas.contentH; c.height = svgCanvas.contentH;
canvg(c, data.svg, {renderCallback: function() { canvg(c, data.svg, {renderCallback: function() {
@ -2785,7 +2785,7 @@ TODOS
// {sel:'#tool_rect', fn: clickRect, evt: 'mouseup', key: 4, parent: '#tools_rect', icon: 'rect'} // {sel:'#tool_rect', fn: clickRect, evt: 'mouseup', key: 4, parent: '#tools_rect', icon: 'rect'}
var pos = ('position' in opts) ? opts.position : 'last'; var pos = ('position' in opts) ? opts.position : 'last';
var len = flyout_holder.children().length; var len = flyout_holder.children().length;
// Add at given position or end // Add at given position or end
@ -3636,8 +3636,8 @@ TODOS
if (!customHandlers.exportImage) { if (!customHandlers.exportImage) {
var str = uiStrings.notification.loadingImage; var str = uiStrings.notification.loadingImage;
exportWindow = window.open( exportWindow = window.open(
'data:text/html;charset=utf-8,' + encodeURIComponent('<title>' + str + '</title><h1>' + str + '</h1>') 'data:text/html;charset=utf-8,' + encodeURIComponent('<title>' + str + '</title><h1>' + str + '</h1>')
); );
} }
var quality = parseInt($('#image-slider').val(), 10)/100; var quality = parseInt($('#image-slider').val(), 10)/100;
if (window.canvg) { if (window.canvg) {
@ -5141,17 +5141,17 @@ TODOS
editor.loadFromDataURI = function(str) { editor.loadFromDataURI = function(str) {
editor.ready(function() { editor.ready(function() {
var base64 = false; var base64 = false;
var pre = str.match(/^data:image\/svg\+xml;base64,/); var pre = str.match(/^data:image\/svg\+xml;base64,/);
if (pre) { if (pre) {
base64 = true; base64 = true;
} }
else { else {
pre = str.match(/^data:image\/svg\+xml(?:;(?:utf8)?)?,/); pre = str.match(/^data:image\/svg\+xml(?:;(?:utf8)?)?,/);
} }
if (pre) { if (pre) {
pre = pre[0]; pre = pre[0];
} }
var src = str.slice(pre.length); var src = str.slice(pre.length);
loadSvgString(base64 ? Utils.decode64(src) : decodeURIComponent(src)); loadSvgString(base64 ? Utils.decode64(src) : decodeURIComponent(src));
}); });