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
This commit is contained in:
Alexis Deveria
2010-10-29 13:13:34 +00:00
parent c5083035ae
commit 985d061674
3 changed files with 26 additions and 5 deletions

View File

@@ -35,7 +35,7 @@
<script type="text/javascript" src="jgraduate/jquery.jgraduate.min.js"></script>
<script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script>
<script type="text/javascript" src="svgedit.compiled.js"></script>
-->
<!-- always minified scripts -->
<script type="text/javascript" src="jquery-ui/jquery-ui-1.8.custom.min.js"></script>

View File

@@ -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

View File

@@ -2071,7 +2071,7 @@ function getElem(id) {
}
// Set scope for these functions
var getId, getNextId;
var getId, getNextId, call;
(function(c) {