Added support for unit width/height when set in document properties
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1372 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
9590cf67f5
commit
984d6263c9
|
@ -722,6 +722,11 @@ span.zoom_tool {
|
||||||
z-index: 20001;
|
z-index: 20001;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#svg_docprops .error {
|
||||||
|
border: 1px solid red;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
#svg_docprops #resolution {
|
#svg_docprops #resolution {
|
||||||
max-width: 14em;
|
max-width: 14em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1513,7 +1513,6 @@ function svg_edit_setup() {
|
||||||
$('#image_save_opts input').val([curPrefs.img_save]);
|
$('#image_save_opts input').val([curPrefs.img_save]);
|
||||||
|
|
||||||
// update resolution option with actual resolution
|
// update resolution option with actual resolution
|
||||||
// TODO: what if SVG source is changed?
|
|
||||||
var res = svgCanvas.getResolution();
|
var res = svgCanvas.getResolution();
|
||||||
$('#canvas_width').val(res.w);
|
$('#canvas_width').val(res.w);
|
||||||
$('#canvas_height').val(res.h);
|
$('#canvas_height').val(res.h);
|
||||||
|
@ -1580,12 +1579,26 @@ function svg_edit_setup() {
|
||||||
svgCanvas.setImageTitle(new_title);
|
svgCanvas.setImageTitle(new_title);
|
||||||
|
|
||||||
// update resolution
|
// update resolution
|
||||||
var x = parseInt($('#canvas_width').val());
|
var width = $('#canvas_width'), w = width.val();
|
||||||
var y = parseInt($('#canvas_height').val());
|
var height = $('#canvas_height'), h = height.val();
|
||||||
if(isNaN(x) || isNaN(y)) {
|
|
||||||
x ='fit';
|
if(w != "fit" && !svgCanvas.isValidUnit('width', w)) {
|
||||||
|
$.alert(uiStrings.invalidAttrValGiven);
|
||||||
|
width.parent().addClass('error');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if(!svgCanvas.setResolution(x,y)) {
|
|
||||||
|
width.parent().removeClass('error');
|
||||||
|
|
||||||
|
if(h != "fit" && !svgCanvas.isValidUnit('height', h)) {
|
||||||
|
$.alert(uiStrings.invalidAttrValGiven);
|
||||||
|
height.parent().addClass('error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
height.parent().removeClass('error');
|
||||||
|
|
||||||
|
if(!svgCanvas.setResolution(w, h)) {
|
||||||
$.alert(uiStrings.noContentToFitTo);
|
$.alert(uiStrings.noContentToFitTo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6105,6 +6105,9 @@ function BatchCommand(text) {
|
||||||
if(!batchCmd) {
|
if(!batchCmd) {
|
||||||
batchCmd = new BatchCommand("Change Image Dimensions");
|
batchCmd = new BatchCommand("Change Image Dimensions");
|
||||||
}
|
}
|
||||||
|
x = convertToNum('width', x);
|
||||||
|
y = convertToNum('height', y);
|
||||||
|
|
||||||
svgcontent.setAttribute('width', x);
|
svgcontent.setAttribute('width', x);
|
||||||
svgcontent.setAttribute('height', y);
|
svgcontent.setAttribute('height', y);
|
||||||
batchCmd.addSubCommand(new ChangeElementCommand(svgcontent, {"width":w, "height":h}));
|
batchCmd.addSubCommand(new ChangeElementCommand(svgcontent, {"width":w, "height":h}));
|
||||||
|
|
Loading…
Reference in New Issue