From 985d061674f55222a9e7b10dd0e299a965b74f48 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Fri, 29 Oct 2010 13:13:34 +0000 Subject: [PATCH] Fixed bug in HTML that broke editor, fixed scope of some variables git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1836 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.html | 2 +- editor/svg-editor.js | 27 ++++++++++++++++++++++++--- editor/svgcanvas.js | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 13694771..25eb034e 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -35,7 +35,7 @@ - +--> diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 0fcffd4d..be7013ef 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1321,11 +1321,30 @@ // This function also updates the opacity and id elements that are in the context panel var updateToolbar = function() { if (selectedElement != null && ['use', 'image', 'foreignObject', 'g', 'a'].indexOf(selectedElement.tagName) === -1) { + var all_swidth = null; + +// if(selectedElement.tagName === "g" || selectedElement.tagName === "a") { +// // Look for common styles +// var childs = selectedElement.getElementsByTagName('*'); +// console.log('ch', childs); +// for(var i = 0, len = childs.length; i < len; i++) { +// var elem = childs[i]; +// var swidth = elem.getAttribute("stroke-width"); +// if(swidth && swidth !== all_swidth) { +// // different, so do don't check more +// all_swidth = null; +// break; +// } else if(swidth) { +// console.log('e', elem, swidth); +// all_swidth = swidth; +// } +// } +// } paintBox.fill.update(true); paintBox.stroke.update(true); - $('#stroke_width').val(selectedElement.getAttribute("stroke-width")||1); + $('#stroke_width').val(all_swidth || selectedElement.getAttribute("stroke-width") || 1); $('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none"); var attr = selectedElement.getAttribute("stroke-linejoin") || 'miter'; @@ -3972,7 +3991,8 @@ // Select given tool Editor.ready(function() { - var itool = curConfig.initTool, + var tool, + itool = curConfig.initTool, container = $("#tools_left, #svg_editor .tools_flyout"), pre_tool = container.find("#tool_" + itool), reg_tool = container.find("#" + itool); @@ -4329,6 +4349,7 @@ } var num = (label_pos - content_d) / u_multi; + var label; if(multi >= 1) { label = Math.round(num); } else { @@ -4405,7 +4426,7 @@ // Callback handler for embedapi.js try{ - json_encode = function(obj){ + var json_encode = function(obj){ //simple partial JSON encoder implementation if(window.JSON && JSON.stringify) return JSON.stringify(obj); var enc = arguments.callee; //for purposes of recursion diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 071efa42..db05a77a 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2071,7 +2071,7 @@ function getElem(id) { } // Set scope for these functions -var getId, getNextId; +var getId, getNextId, call; (function(c) {