Made canvas center on window resize, fixed error occurring on cloning end path nodes

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1544 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-04-23 19:40:09 +00:00
parent 20c6001a72
commit 8030f867a3
2 changed files with 17 additions and 4 deletions

View File

@ -2474,11 +2474,19 @@
$('#image_save_opts input').val([curPrefs.img_save]);
docprops = false;
};
var win_wh = {width:$(window).width(), height:$(window).height()};
// TODO: add canvas-centering code in here
$(window).resize(function(evt) {
if (!editingsource) return;
properlySourceSizeTextArea();
if (editingsource) {
properlySourceSizeTextArea();
}
$.each(win_wh, function(type, val) {
var curval = $(window)[type]();
workarea[0]['scroll' + (type==='width'?'Left':'Top')] -= (curval - val)/2;
win_wh[type] = curval;
});
});
$('#url_notice').click(function() {
@ -3545,9 +3553,11 @@
'url': url,
'dataType': 'text',
success: svgCanvas.setSvgString,
error: function(xhr) {
error: function(xhr, stat, err) {
if(xhr.responseText) {
svgCanvas.setSvgString(xhr.responseText);
} else {
$.alert("Unable to load from URL. Error: \n"+err+'');
}
}
});

View File

@ -4790,6 +4790,9 @@ function BatchCommand(text) {
this.addSeg = function(index) {
// Adds a new segment
var seg = p.segs[index];
if(!seg.prev) return;
var prev = seg.prev;
var new_x = (seg.item.x + prev.item.x) / 2;