Fixed misc bugs, made root only include namespace declarations when necessary
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1510 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -752,7 +752,7 @@ span.zoom_tool {
|
|||||||
#option_lists ul {
|
#option_lists ul {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 90px;
|
height: auto;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|||||||
@@ -1711,10 +1711,6 @@
|
|||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// $('#cur_linecap').mousedown(function() {
|
|
||||||
// $('#linecap_opts').show();
|
|
||||||
// });
|
|
||||||
|
|
||||||
addAltDropDown('#stroke_linecap', '#linecap_opts', function() {
|
addAltDropDown('#stroke_linecap', '#linecap_opts', function() {
|
||||||
var val = this.id.split('_')[1];
|
var val = this.id.split('_')[1];
|
||||||
svgCanvas.setStrokeAttr('stroke-linecap', val);
|
svgCanvas.setStrokeAttr('stroke-linecap', val);
|
||||||
@@ -2267,7 +2263,8 @@
|
|||||||
'line-height': {s: '15px'}
|
'line-height': {s: '15px'}
|
||||||
},
|
},
|
||||||
"#tools_bottom_2": {
|
"#tools_bottom_2": {
|
||||||
'width': {l: '295px', xl: '355px'}
|
'width': {l: '295px', xl: '355px'},
|
||||||
|
'top': {s: '4px'}
|
||||||
},
|
},
|
||||||
"#tools_top > div, #tools_top": {
|
"#tools_top > div, #tools_top": {
|
||||||
'line-height': {s: '17px', l: '34px', xl: '50px'}
|
'line-height': {s: '17px', l: '34px', xl: '50px'}
|
||||||
|
|||||||
@@ -1140,6 +1140,7 @@ function BatchCommand(text) {
|
|||||||
var handle = svgroot.suspendRedraw(60);
|
var handle = svgroot.suspendRedraw(60);
|
||||||
var defaults = {
|
var defaults = {
|
||||||
'fill-opacity':1,
|
'fill-opacity':1,
|
||||||
|
'stop-opacity':1,
|
||||||
'opacity':1,
|
'opacity':1,
|
||||||
'stroke':'none',
|
'stroke':'none',
|
||||||
'stroke-dasharray':'none',
|
'stroke-dasharray':'none',
|
||||||
@@ -1600,15 +1601,40 @@ function BatchCommand(text) {
|
|||||||
// Process root element separately
|
// Process root element separately
|
||||||
var res = canvas.getResolution();
|
var res = canvas.getResolution();
|
||||||
out.push(' width="' + res.w + '" height="' + res.h + '" xmlns="'+svgns+'"');
|
out.push(' width="' + res.w + '" height="' + res.h + '" xmlns="'+svgns+'"');
|
||||||
|
|
||||||
|
var nsuris = {};
|
||||||
|
|
||||||
|
// Check elements for namespaces, add if found
|
||||||
|
$(elem).find('*').andSelf().each(function() {
|
||||||
|
var el = this;
|
||||||
|
$.each(this.attributes, function(i, attr) {
|
||||||
|
var uri = attr.namespaceURI;
|
||||||
|
if(uri && !nsuris[uri] && nsMap[uri] !== 'xmlns') {
|
||||||
|
nsuris[uri] = true;
|
||||||
|
// console.log('add', nsMap[uri]);
|
||||||
|
// if(nsMap[uri] == 'xmlns') {
|
||||||
|
// console.log('hm',el, attr.nodeName);
|
||||||
|
// }
|
||||||
|
out.push(" xmlns:" + nsMap[uri] + '="' + uri +'"');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var i = attrs.length;
|
var i = attrs.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
attr = attrs.item(i);
|
attr = attrs.item(i);
|
||||||
var attrVal = toXml(attr.nodeValue);
|
var attrVal = toXml(attr.nodeValue);
|
||||||
|
|
||||||
|
// Namespaces have already been dealt with, so skip
|
||||||
|
if(attr.nodeName.indexOf('xmlns:') === 0) continue;
|
||||||
|
|
||||||
// only serialize attributes we don't use internally
|
// only serialize attributes we don't use internally
|
||||||
if (attrVal != "" &&
|
if (attrVal != "" &&
|
||||||
$.inArray(attr.localName, ['width','height','xmlns','x','y','viewBox','id','overflow']) == -1)
|
$.inArray(attr.localName, ['width','height','xmlns','x','y','viewBox','id','overflow']) == -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!attr.namespaceURI || nsMap[attr.namespaceURI]) {
|
if(!attr.namespaceURI || nsMap[attr.namespaceURI]) {
|
||||||
|
console.log(!attr.namespaceURI, nsMap[attr.namespaceURI]);
|
||||||
out.push(' ');
|
out.push(' ');
|
||||||
out.push(attr.nodeName); out.push("=\"");
|
out.push(attr.nodeName); out.push("=\"");
|
||||||
out.push(attrVal); out.push("\"");
|
out.push(attrVal); out.push("\"");
|
||||||
@@ -5982,6 +6008,9 @@ function BatchCommand(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content.attr(attrs);
|
content.attr(attrs);
|
||||||
|
this.contentW = attrs['width'];
|
||||||
|
this.contentH = attrs['height'];
|
||||||
|
|
||||||
batchCmd.addSubCommand(new InsertElementCommand(svgcontent));
|
batchCmd.addSubCommand(new InsertElementCommand(svgcontent));
|
||||||
// update root to the correct size
|
// update root to the correct size
|
||||||
var changes = content.attr(["width", "height"]);
|
var changes = content.attr(["width", "height"]);
|
||||||
@@ -6949,9 +6978,7 @@ function BatchCommand(text) {
|
|||||||
|
|
||||||
if(diff) continue;
|
if(diff) continue;
|
||||||
}
|
}
|
||||||
this.contentW = attrs['width'];
|
|
||||||
this.contentH = attrs['height'];
|
|
||||||
|
|
||||||
// else could be a duplicate, iterate through stops
|
// else could be a duplicate, iterate through stops
|
||||||
var stops = grad.getElementsByTagNameNS(svgns, "stop");
|
var stops = grad.getElementsByTagNameNS(svgns, "stop");
|
||||||
var ostops = og.getElementsByTagNameNS(svgns, "stop");
|
var ostops = og.getElementsByTagNameNS(svgns, "stop");
|
||||||
|
|||||||
Reference in New Issue
Block a user