diff --git a/index.html b/index.html
index 7f4c2a7..03cc2dd 100644
--- a/index.html
+++ b/index.html
@@ -332,7 +332,7 @@
var w = 19, unit=18;
var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
- cht.locktoggle = true;
+ cht.locktoggle = null;
path.setAttribute("stroke", color);
path.setAttribute("stroke-width", 4);
path.setAttribute("fill", "none");
@@ -344,17 +344,17 @@
svg = document.getElementById(idgroup);
svg.appendChild(path);
- path.addEventListener("mouseenter", function(){if(cht.locktoggle){
+ path.addEventListener("mouseenter", function(){if(!cht.locktoggle){
emphasize(cht, from, to);path.setAttribute("stroke-width", 10);}});
- path.addEventListener("mouseleave", function(){if(cht.locktoggle){
+ path.addEventListener("mouseleave", function(){if(!cht.locktoggle){
emphasize(cht, from, -to);path.setAttribute("stroke-width", 4);}});
- path.addEventListener("click", function(){
- if (cht.locktoggle) {
- path.setAttribute("stroke-width", 14);
- cht.locktoggle = false;
- } else {
+ path.addEventListener("click", function(e){
+ if (cht.locktoggle == e.target) {
path.setAttribute("stroke-width", 10);
- cht.locktoggle = true;
+ cht.locktoggle = null;
+ } else if (!cht.locktoggle){
+ path.setAttribute("stroke-width", 14);
+ cht.locktoggle = e.target;
}});
}