From e4805a123f1c564fa8bf45ede3d63dc93058f561 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Wed, 23 Dec 2009 20:29:44 +0000 Subject: [PATCH] Prevented NaN values when selecting fit-to zoom options, made first layer be renamed on language change git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1107 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 9 +++++++++ editor/svgcanvas.js | 1 + 2 files changed, 10 insertions(+) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 2e985990..f50e7323 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -2163,9 +2163,18 @@ function svg_edit_setup() { $('#lang_select').val(lang); if(strings) { // $.extend will only replace the given strings + var oldLayerName = $('#layerlist tr.layersel td.layername').text(); + var rename_layer = (oldLayerName == uiStrings.layer + ' 1'); + $.extend(uiStrings,strings); svgCanvas.setUiStrings(strings); Actions.setTitles(); + + if(rename_layer) { + svgCanvas.renameCurrentLayer(uiStrings.layer + ' 1'); + populateLayers(); + } + } }; diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 9a99a1bd..0d9262fe 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -5101,6 +5101,7 @@ function BatchCommand(text) { var spacer = .85; var bb; var calcZoom = function(bb) { + if(!bb) return false; var w_zoom = Math.round((editor_w / bb.width)*100 * spacer)/100; var h_zoom = Math.round((editor_h / bb.height)*100 * spacer)/100; var zoomlevel = Math.min(w_zoom,h_zoom);