Buglet in latest SVG-Edit

Sync with latest SVG-Edit.
Among other things, fixes Issue 512.
This commit is contained in:
Jacques Distler 2010-04-06 13:39:21 -05:00
parent da0c6a2ea1
commit 6d5db0739a
5 changed files with 308 additions and 48 deletions

View file

@ -1,4 +1,4 @@
/*
/*
* svgcanvas.js
*
* Licensed under the Apache License, Version 2
@ -5980,7 +5980,9 @@ function BatchCommand(text) {
}
});
}
this.contentW = attrs['width'];
this.contentH = attrs['height'];
content.attr(attrs);
batchCmd.addSubCommand(new InsertElementCommand(svgcontent));
// update root to the correct size
@ -6742,6 +6744,8 @@ function BatchCommand(text) {
svgcontent.setAttribute('width', x);
svgcontent.setAttribute('height', y);
this.contentW = x;
this.contentH = y;
batchCmd.addSubCommand(new ChangeElementCommand(svgcontent, {"width":w, "height":h}));
svgcontent.setAttribute("viewBox", [0, 0, x/current_zoom, y/current_zoom].join(' '));
@ -7866,23 +7870,29 @@ function BatchCommand(text) {
};
}
this.contentW = this.getResolution().w;
this.contentH = this.getResolution().h;
this.updateCanvas = function(w, h, w_orig, h_orig) {
svgroot.setAttribute("width", w);
svgroot.setAttribute("height", h);
var bg = $('#canvasBackground')[0];
var old_x = svgcontent.getAttribute('x');
var old_y = svgcontent.getAttribute('y');
var x = (w/2 - svgcontent.getAttribute('width')*current_zoom/2);
var y = (h/2 - svgcontent.getAttribute('height')*current_zoom/2);
var x = (w/2 - this.contentW*current_zoom/2);
var y = (h/2 - this.contentH*current_zoom/2);
assignAttributes(svgcontent, {
width: this.contentW*current_zoom,
height: this.contentH*current_zoom,
'x': x,
'y': y
'y': y,
"viewBox" : "0 0 " + this.contentW + " " + this.contentH
});
assignAttributes(bg, {
width: svgcontent.getAttribute('width') * current_zoom,
height: svgcontent.getAttribute('height') * current_zoom,
width: svgcontent.getAttribute('width'),
height: svgcontent.getAttribute('height'),
x: x,
y: y
});
@ -8303,7 +8313,7 @@ function BatchCommand(text) {
// Function: getVersion
// Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function() {
return "svgcanvas.js ($Rev: 1498 $)";
return "svgcanvas.js ($Rev: 1504 $)";
};
this.setUiStrings = function(strs) {