Permalink
Browse files

Fixed bug, altered sample

-Bug: '+'-Nodes in edit mode could be edited
  • Loading branch information...
1 parent b82a95b commit ffb90cee09d118899daeb31b4de2144723a8735a @marcelklehr committed May 24, 2011
Showing with 24 additions and 27 deletions.
  1. +10 −12 buzzmap.js
  2. +14 −15 sample.htm
View
@@ -113,17 +113,17 @@
this.el.click(function(event){
return false;
});
- if(thisnode.el.hasClass('addNode'))
- {
- this.el.dblclick(opennode);
- }else{
- this.el.dblclick(function(event){
- var old_value = thisnode.el.html();
+ this.el.dblclick(function(event){
+ if(thisnode.el.hasClass('addNode'))
+ return true;
+
+ var old_value = $('span:eq(0)', thisnode.el).html();
thisnode.el.html('');
thisnode.el.click(function(){return false;})
var $input = $('<input type="text"/>').val(old_value);
$input.blur(function(event){
- thisnode.el.html(old_value);
+ if($input.val() != '')
+ thisnode.el.html($('<span>'+$input.val()+'</span>'));
})
.click(function(){return false;})
.keyup(function(event) {
@@ -134,22 +134,20 @@
obj.root.animateToStatic();
}
else if(keycode == 13) { // enter
- thisnode.el.html('');
- $($input.val()).appendTo(thisnode.el);
+ thisnode.el.html($('<span>'+$input.val()+'</span>'));
thisnode.el.addClass('active');
obj.root.animateToStatic();
}
return true;
})
.appendTo(thisnode.el)
if(thisnode != obj.root)
- $('<a href="#">[x]</a>').click(function(){
+ $('<a style="margin-left:1em;" href="#">[x]</a>').click(function(){
thisnode.removeNode();
obj.root.animateToStatic();
}).appendTo(thisnode.el);
$input.focus().select();
});
- }
}else{
this.el.click(opennode);
}
@@ -507,7 +505,7 @@
lineColor: '#FFF',
lineOpacity: 0.3,
centerOffset:100,
- centerAttraction:3,
+ centerAttraction:0,
timeout: 5
},options);
View
@@ -1,8 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <!-- Kenneth Kufluk 2008/09/10 -->
- <title>js-mindmap demo - JavaScript Mindmap</title>
+ <title>buzzmap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="buzzmap.css" rel="stylesheet" type="text/css"/>
<link href="custom-style.css" type="text/css" rel="stylesheet"/>
@@ -23,7 +22,7 @@
<script type="text/javascript">
<!--
$(document).ready(function (){
- $('body').buzzmap({timer: 1});
+ $('body').buzzmap({editable:true, centerAttraction: 0});
});
-->
</script>
@@ -34,17 +33,17 @@
<li><div><span>buzzmap</span></div>
<ul>
- <li><div><span>Resources</a></div>
+ <li><div><span>Resources</span></div>
<ul>
<li><div><span>Raphaël</span></div></li>
<li><div><span>jQuery</span></div></li>
<li><div><span>jQueryUI</span></div></li>
- <li><div><a href="https://github.com/kennethkufluk/js-mindmap" target="_blank">js-mindmap</a></div></li>
+ <li><div><span><a href="https://github.com/kennethkufluk/js-mindmap" target="_blank">js-mindmap</a></span></div></li>
</ul>
</li>
- <li><div><span>Functions</a></div>
+ <li><div><span>Functions</a></span></div>
<ul>
<li><div><span>Mindmapping</span></div></li>
@@ -56,22 +55,22 @@
</li>
<li><div><span>Files</span></div>
<ul>
- <li><div><a href="sample.htm" target="_blank">sample.htm</a></div></li>
- <li><div><a href="js-mindmap.js" target="_blank">buzzmap.js</a></div></li>
- <li><div><a href="js-mindmap.css" target="_blank">buzzmap.css</a></div></li>
- <li><div><a href="raphael-min.js" target="_blank">raphael.min.js</a></div></li>
- <li><div><a href="jquery-1.4.3.min.js" target="_blank">jquery.min.js</a></div></li>
- <li><div><a href="jquery-ui-1.8.12.min.js" target="_blank">jquery-ui.min.js</a></div></li>
+ <li><div><span><a href="sample.htm" target="_blank">sample.htm</a></span></div></li>
+ <li><div><span><a href="js-mindmap.js" target="_blank">buzzmap.js</a></span></div></li>
+ <li><div><span><a href="js-mindmap.css" target="_blank">buzzmap.css</a></span></div></li>
+ <li><div><span><a href="raphael-min.js" target="_blank">raphael.min.js</a></span></div></li>
+ <li><div><span><a href="jquery-1.4.3.min.js" target="_blank">jquery.min.js</a></span></div></li>
+ <li><div><span><a href="jquery-ui-1.8.12.min.js" target="_blank">jquery-ui.min.js</a></span></div></li>
</ul>
</li>
- <li><div><span>Licence</a></div>
+ <li><div><span>Licence</a></span></div>
<ul>
<li><div><span>MIT Licence</span></div></li>
- <li><div><a href="LICENCE.txt" target="_blank">Conditions</a></div></li>
+ <li><div><span><a href="LICENCE.txt" target="_blank">Conditions</a></span></div></li>
</ul>
- <li><div><span>Secret</a></div>
+ <li><div><span>Secret</a></span></div>
<ul>
<li><div><span>It's free...</span></div></li>
</ul>

0 comments on commit ffb90ce

Please sign in to comment.