Made root SVG width/height be set to base unit on serialization, fixed minor path drawing bug
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1826 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
2ce416fa7e
commit
6900460816
|
@ -1797,10 +1797,6 @@
|
|||
} else if(curConfig.baseUnit !== 'px') {
|
||||
// Convert unitless value to one with given unit
|
||||
|
||||
// val = svgCanvas.convertUnit(bv, "px");
|
||||
// selectedElement[attr].baseVal.newValueSpecifiedUnits();
|
||||
// this.value = val;
|
||||
// selectedElement[attr].baseVal
|
||||
var unitData = svgCanvas.getUnits();
|
||||
|
||||
if(selectedElement[attr] || svgCanvas.getMode() === "pathedit" || attr === "x" || attr === "y") {
|
||||
|
@ -2605,6 +2601,11 @@
|
|||
|
||||
// update resolution option with actual resolution
|
||||
var res = svgCanvas.getResolution();
|
||||
if(curConfig.baseUnit !== "px") {
|
||||
res.w = svgCanvas.convertUnit(res.w) + curConfig.baseUnit;
|
||||
res.h = svgCanvas.convertUnit(res.h) + curConfig.baseUnit;
|
||||
}
|
||||
|
||||
$('#canvas_width').val(res.w);
|
||||
$('#canvas_height').val(res.h);
|
||||
$('#canvas_title').val(svgCanvas.getDocumentTitle());
|
||||
|
|
|
@ -7022,6 +7022,9 @@ var pathActions = this.pathActions = function() {
|
|||
if(last.pathSegType === 6) {
|
||||
last_x += (last_x - last.x2);
|
||||
last_y += (last_y - last.y2);
|
||||
} else if(firstCtrl) {
|
||||
last_x = firstCtrl[0];
|
||||
last_y = firstCtrl[1];
|
||||
}
|
||||
replacePathSeg(6, index, [pt_x, pt_y, last_x, last_y, alt_x, alt_y], drawn_path);
|
||||
}
|
||||
|
@ -7846,6 +7849,11 @@ var svgToString = this.svgToString = function(elem, indent) {
|
|||
// res.h += unit;
|
||||
// }
|
||||
|
||||
if(unit !== "px") {
|
||||
res.w = canvas.convertUnit(res.w, unit) + unit;
|
||||
res.h = canvas.convertUnit(res.h, unit) + unit;
|
||||
}
|
||||
|
||||
out.push(' width="' + res.w + '" height="' + res.h + '"' + vb + ' xmlns="'+svgns+'"');
|
||||
|
||||
var nsuris = {};
|
||||
|
@ -9222,10 +9230,13 @@ this.getSelectedElems = function() { return selectedElements; };
|
|||
var getResolution = this.getResolution = function() {
|
||||
// var vb = svgcontent.getAttribute("viewBox").split(' ');
|
||||
// return {'w':vb[2], 'h':vb[3], 'zoom': current_zoom};
|
||||
|
||||
|
||||
var width = svgcontent.getAttribute("width")/current_zoom;
|
||||
var height = svgcontent.getAttribute("height")/current_zoom;
|
||||
|
||||
return {
|
||||
'w':svgcontent.getAttribute("width")/current_zoom,
|
||||
'h':svgcontent.getAttribute("height")/current_zoom,
|
||||
'w': width,
|
||||
'h': height,
|
||||
'zoom': current_zoom
|
||||
};
|
||||
};
|
||||
|
@ -9413,11 +9424,13 @@ this.setResolution = function(x, y) {
|
|||
if(!batchCmd) {
|
||||
batchCmd = new BatchCommand("Change Image Dimensions");
|
||||
}
|
||||
|
||||
x = convertToNum('width', x);
|
||||
y = convertToNum('height', y);
|
||||
|
||||
svgcontent.setAttribute('width', x);
|
||||
svgcontent.setAttribute('height', y);
|
||||
|
||||
this.contentW = x;
|
||||
this.contentH = y;
|
||||
batchCmd.addSubCommand(new ChangeElementCommand(svgcontent, {"width":w, "height":h}));
|
||||
|
|
Loading…
Reference in New Issue