Make changing resolution undo/redo-able

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@202 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2009-06-26 14:31:03 +00:00
parent ecb0f0e74e
commit cfa488a502
2 changed files with 18 additions and 6 deletions

View File

@@ -37,6 +37,12 @@ function svg_edit_setup() {
// called when any element has changed
var elementChanged = function(window,elem) {
// if the element changed was the svg, then it must be a resolution change
if (elem && elem.tagName == "svg") {
changeResolution(parseInt(elem.getAttribute("width")),
parseInt(elem.getAttribute("height")));
}
// we update the contextual panel with potentially new
// positional/sizing information (we DON'T want to update the
// toolbar here as that creates an infinite loop)
@@ -518,16 +524,20 @@ function svg_edit_setup() {
$('#tools_ellipse').show();
});
$('#resolution').change(function(){
var res = this.value.split('x');
var x = parseInt(res[0]), y = parseInt(res[1]);
svgCanvas.setResolution(x,y);
function changeResolution(x,y) {
$('#resolution').val(x+'x'+y);
$('#svgroot').css( { 'width': x, 'height': y } );
$('#svgcanvas').css( { 'width': x, 'height': y } );
$('div#palette_holder').css('width', x);
$('#context_tools').css('width', x + 65);
$('#tools').css('height', y + 24);
$('#footer').css('width', x + 65);
}
$('#resolution').change(function(){
var res = this.value.split('x');
var x = parseInt(res[0]), y = parseInt(res[1]);
svgCanvas.setResolution(x,y);
});
return svgCanvas;