Sync with latest SVG-Edit

Loading of configuration data via URL query string.
Now no differences, from trunk, in svgcanvas.js or svg-edit.js.
This commit is contained in:
Jacques Distler 2010-03-15 11:13:22 -05:00
parent c946c331e1
commit 5167363a2d
6 changed files with 2749 additions and 2677 deletions

View file

@ -82,7 +82,7 @@ function setupSVGedit(path){
f.insert({top: SVGeditButton}); f.insert({top: SVGeditButton});
SVGeditButton.disabled = true; SVGeditButton.disabled = true;
Event.observe(SVGeditButton, 'click', function(){ Event.observe(SVGeditButton, 'click', function(){
var editor = window.open(path, 'Edit SVG graphic', 'status=1,resizable=1,scrollbars=1'); var editor = window.open(path + "?initStroke[width]=2", 'Edit SVG graphic', 'status=1,resizable=1,scrollbars=1');
editor.addEventListener("load", function() { editor.addEventListener("load", function() {
editor.svgEditor.setCustomHandlers({ editor.svgEditor.setCustomHandlers({
'save': function(window,svg){ 'save': function(window,svg){

View file

@ -46,6 +46,9 @@ $.jGraduate.Paint({hex: "#rrggbb", linearGradient: o}) -> throws an exception?
* *
*/ */
(function() {
var ns = { svg: 'http://www.w3.org/2000/svg', xlink: 'http://www.w3.org/1999/xlink' }; var ns = { svg: 'http://www.w3.org/2000/svg', xlink: 'http://www.w3.org/1999/xlink' };
if(!window.console) { if(!window.console) {
window.console = new function() { window.console = new function() {
@ -1083,3 +1086,4 @@ jQuery.fn.jGraduate =
$this.show(); $this.show();
}); });
}; };
})();

View file

@ -674,7 +674,7 @@ span.zoom_tool {
} }
#svg_editor #tools_bottom_2 { #svg_editor #tools_bottom_2 {
width: 204px; width: 215px;
position: relative; position: relative;
float: left; float: left;
} }
@ -706,6 +706,7 @@ span.zoom_tool {
-moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomleft: 4px;
-webkit-border-top-left-radius: 4px; -webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-left-radius: 4px;
padding-right: 0;
} }
.color_tool > *:last-child { .color_tool > *:last-child {

View file

@ -14,6 +14,7 @@
<script type="text/javascript" src="js-hotkeys/jquery.hotkeys.min.js"></script> <script type="text/javascript" src="js-hotkeys/jquery.hotkeys.min.js"></script>
<script type="text/javascript" src="jgraduate/jquery.jgraduate.js"></script> <script type="text/javascript" src="jgraduate/jquery.jgraduate.js"></script>
<script type="text/javascript" src="svgicons/jquery.svgicons.js"></script> <script type="text/javascript" src="svgicons/jquery.svgicons.js"></script>
<script type="text/javascript" src="jquerybbq/jquery.bbq.min.js"></script>
<script type="text/javascript" src="spinbtn/JQuerySpinBtn.js"></script> <script type="text/javascript" src="spinbtn/JQuerySpinBtn.js"></script>
<script type="text/javascript" src="locale/locale.js"></script> <script type="text/javascript" src="locale/locale.js"></script>
<script type="text/javascript" src="svgcanvas.js"></script> <script type="text/javascript" src="svgcanvas.js"></script>
@ -28,6 +29,7 @@
<!-- Release version of script tags: > <!-- Release version of script tags: >
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" src="js-hotkeys/jquery.hotkeys-0.7.9.js"></script> <script type="text/javascript" src="js-hotkeys/jquery.hotkeys-0.7.9.js"></script>
<script type="text/javascript" src="jquerybbq/jquery.bbq.min.js"></script>
<script type="text/javascript" src="jgraduate/jquery.jgraduate.min.js"></script> <script type="text/javascript" src="jgraduate/jquery.jgraduate.min.js"></script>
<script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script> <script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script>
<script type="text/javascript" src="svgcanvas.min.js"></script> <script type="text/javascript" src="svgcanvas.min.js"></script>

File diff suppressed because it is too large Load diff

View file

@ -60,7 +60,7 @@ if(window.opera) {
} else if(typeof key === "object") { } else if(typeof key === "object") {
// Setting attributes form object // Setting attributes form object
for(v in key) { for(var v in key) {
elem.setAttribute(v, key[v]); elem.setAttribute(v, key[v]);
} }
// Getting attribute // Getting attribute
@ -170,7 +170,8 @@ var isOpera = !!window.opera,
}, },
curConfig = { curConfig = {
show_outside_canvas: true show_outside_canvas: true,
dimensions: [640, 480]
}, },
toXml = function(str) { toXml = function(str) {
@ -672,10 +673,11 @@ function BatchCommand(text) {
if($("#canvasBackground").length) return; if($("#canvasBackground").length) return;
var canvasbg = svgdoc.createElementNS(svgns, "svg"); var canvasbg = svgdoc.createElementNS(svgns, "svg");
var dims = curConfig.dimensions;
assignAttributes(canvasbg, { assignAttributes(canvasbg, {
'id':'canvasBackground', 'id':'canvasBackground',
'width': 640, 'width': dims[0],
'height': 480, 'height': dims[1],
'x': 0, 'x': 0,
'y': 0, 'y': 0,
'overflow': 'visible', 'overflow': 'visible',
@ -935,8 +937,9 @@ function BatchCommand(text) {
mathns = "http://www.w3.org/1998/Math/MathML", mathns = "http://www.w3.org/1998/Math/MathML",
idprefix = "svg_", idprefix = "svg_",
svgdoc = container.ownerDocument, svgdoc = container.ownerDocument,
dimensions = curConfig.dimensions,
svgroot = svgdoc.importNode(Utils.text2xml('<svg id="svgroot" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ' + svgroot = svgdoc.importNode(Utils.text2xml('<svg id="svgroot" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ' +
'width="640" height="480" x="640" y="480" overflow="visible">' + 'width="' + dimensions[0] + '" height="' + dimensions[1] + '" x="' + dimensions[0] + '" y="' + dimensions[1] + '" overflow="visible">' +
'<defs>' + '<defs>' +
'<filter id="canvashadow" filterUnits="objectBoundingBox">' + '<filter id="canvashadow" filterUnits="objectBoundingBox">' +
'<feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>'+ '<feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>'+
@ -981,10 +984,10 @@ function BatchCommand(text) {
// Produce a Namespace-aware version of svgWhitelist // Produce a Namespace-aware version of svgWhitelist
var svgWhiteListNS = {}; var svgWhiteListNS = {};
$.each(svgWhiteList, function(elt,atts){ $.each(svgWhiteList, function(elt,atts){
attNS = {}; var attNS = {};
$.each(atts, function(i, att){ $.each(atts, function(i, att){
if (att.indexOf(':') != -1) { if (att.indexOf(':') != -1) {
v=att.split(':'); var v = att.split(':');
attNS[v[1]] = nsRevMap[v[0]]; attNS[v[1]] = nsRevMap[v[0]];
} else { } else {
attNS[att] = att == 'xmlns' ? xmlnsns : null; attNS[att] = att == 'xmlns' ? xmlnsns : null;
@ -996,10 +999,10 @@ function BatchCommand(text) {
var svgcontent = svgdoc.createElementNS(svgns, "svg"); var svgcontent = svgdoc.createElementNS(svgns, "svg");
$(svgcontent).attr({ $(svgcontent).attr({
id: 'svgcontent', id: 'svgcontent',
width: 640, width: dimensions[0],
height: 480, height: dimensions[1],
x: 640, x: dimensions[0],
y: 480, y: dimensions[1],
overflow: curConfig.show_outside_canvas?'visible':'hidden', overflow: curConfig.show_outside_canvas?'visible':'hidden',
xmlns: svgns, xmlns: svgns,
"xmlns:se": se_ns, "xmlns:se": se_ns,
@ -1200,15 +1203,15 @@ function BatchCommand(text) {
current_resize_mode = "none", current_resize_mode = "none",
all_properties = { all_properties = {
shape: { shape: {
fill: "#FF0000", fill: "#" + curConfig.initFill.color,
fill_paint: null, fill_paint: null,
fill_opacity: 1, fill_opacity: curConfig.initFill.opacity,
stroke: "#000000", stroke: "#" + curConfig.initStroke.color,
stroke_paint: null, stroke_paint: null,
stroke_opacity: 1, stroke_opacity: curConfig.initStroke.opacity,
stroke_width: 2, stroke_width: curConfig.initStroke.width,
stroke_style: 'none', stroke_style: 'none',
opacity: 1 opacity: curConfig.initOpacity
} }
}; };
@ -8107,7 +8110,7 @@ function BatchCommand(text) {
// Function: getVersion // Function: getVersion
// Returns a string which describes the revision number of SvgCanvas. // Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function() { this.getVersion = function() {
return "svgcanvas.js ($Rev: 1456 $)"; return "svgcanvas.js ($Rev: 1459 $)";
}; };
this.setUiStrings = function(strs) { this.setUiStrings = function(strs) {