Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Root style

  • Loading branch information...
commit 42ffd1ae8ec6d134d3763242c9839e49b2c85d94 1 parent 2a8f68c
@marcelklehr authored
Showing with 22 additions and 20 deletions.
  1. +1 −1  buzzmap.min.js
  2. +21 −19 custom-style.css
View
2  buzzmap.min.js
@@ -12,7 +12,7 @@ c(this.el).height()/2,this.dy=this.dx=0,!1;var a=this.getForceVector();this.dx+=
Math.max(1,this.x));this.y=Math.min(this.obj.options.mapArea.y,Math.max(1,this.y));var a=this.x-c(this.el).width()/2,b=this.y-c(this.el).height()/2-10;this.el.css("left",a+"px");this.el.css("top",b+"px");return!1};g.prototype.getForceVector=function(){for(var a=0,b=0,e=this.obj.nodes,f=this.obj.lines,c=0;c<e.length;c++)if(e[c]!==this&&(!this.obj.options.showSublines||e[c].hasPosition)&&e[c].visible){var d=e[c].x-this.x,h=e[c].y-this.y,i=d/Math.abs(d);Math.abs(h);var g=Math.sqrt(d*d+h*h),h=Math.atan(h/
d);d===0&&(h=Math.PI/2,i=0);d=this.obj.options.repulse*500/(g*g);Math.abs(g)<500&&(a+=-d*Math.cos(h)*i,b+=-d*Math.sin(h)*i)}c=this.x+this.el.width();d=this.obj.options.wallrepulse*500/(c*c);a+=Math.min(2,d);c=this.obj.options.mapArea.x-c;d=-(this.obj.options.wallrepulse*500)/(c*c);a+=Math.max(-2,d);d=this.obj.options.wallrepulse*500/(this.y*this.y);b+=Math.min(2,d);c=this.obj.options.mapArea.y-this.y;d=-(this.obj.options.wallrepulse*500)/(c*c);b+=Math.max(-2,d);for(c=0;c<f.length;c++){e=null;if(f[c].start===
this)e=f[c].end;else if(f[c].end===this)e=f[c].start;else continue;e.visible&&(d=e.x-this.x,h=e.y-this.y,g=Math.sqrt(d*d+h*h),i=d/Math.abs(d),h=Math.atan(h/d),d==0&&(h=Math.PI/2,i=0),d=this.obj.options.attract*g/1E4,Math.abs(g)>0&&(a+=d*Math.cos(h)*i,b+=d*Math.sin(h)*i))}if(!this.parent)e=this.obj.options.mapArea,d=e.x/2-this.obj.options.centerOffset-this.x,h=e.y/2-this.y,g=Math.sqrt(d*d+h*h),i=d/Math.abs(d),h=Math.atan(h/d),d===0&&(h=Math.PI/2,i=0),d=0.1*this.obj.options.attract*g*this.obj.options.centerAttraction/
-1E3,Math.abs(g)>0&&(a+=d*Math.cos(h)*i,b+=d*Math.sin(h)*i);Math.abs(a)>this.obj.options.maxForce&&(a=this.obj.options.maxForce*(a/Math.abs(a)));Math.abs(b)>this.obj.options.maxForce&&(b=this.obj.options.maxForce*(b/Math.abs(b)));return{x:a,y:b}};c.fn.buzzmap=function(a){var b=c("ul:eq(0)",this);b.hasClass("buzzmap-active")||b.each(function(){var b=new j(c(this),a);b.el.addClass("buzzmap-active");b.el[0].obj=b;if(b.options.loadData){var f=c.parseJSON(a.loadData),g=function(a,d){c.each(d,function(c,
+1E3,Math.abs(g)>0&&(a+=d*Math.cos(h)*i,b+=d*Math.sin(h)*i);Math.abs(a)>this.obj.options.maxForce&&(a=this.obj.options.maxForce*(a/Math.abs(a)));Math.abs(b)>this.obj.options.maxForce&&(b=this.obj.options.maxForce*(b/Math.abs(b)));return{x:a,y:b}};c.fn.buzzmap=function(a){var b=c(this).filter("ul");b.hasClass("buzzmap-active")||b.each(function(){var b=new j(c(this),a);b.el.addClass("buzzmap-active");b.el[0].obj=b;if(b.options.loadData){var f=c.parseJSON(a.loadData),g=function(a,d){c.each(d,function(c,
d){node=b.addNode(a,decodeURI(d.label));g(node,d.children)})};c.each(f.children,function(a,c){node=b.addNode(b.root,decodeURI(c.label));g(node,c.children)})}else{var d=function(){var a=c(this).parents("li").get(0),a=typeof a==="undefined"?b.root:a.mynode;this.mynode=b.addNode(a,c("div:eq(0)",this).html());c(this).hide();c(">ul>li",this).each(d)};c(">li",b.el).each(d)}b.animate()});return b[0].obj};var j=function(a,b){var e=this;this.el=a;this.nodes=[];this.lines=[];this.parseOptions(b);this.movementStopped=
this.editing=this.moving=!1;this.fps=0;window.setInterval(function(){var a=e.fps;e.fps=0;e.trigger("fps",a)},1E3);this.root=this.nodes[0]=new g(this,null,"<span>__ROOT__</span>");c(window).resize(function(){e.animate()});if(this.options.mapArea.x==-1)this.options.mapArea.x=c(window).width();if(this.options.mapArea.y==-1)this.options.mapArea.y=c(window).height();this.canvas=Raphael(0,0,this.options.mapArea.x,this.options.mapArea.y)};k.mixin(j);j.prototype.addNode=function(a,b){var c=this.nodes[this.nodes.length]=
new g(this,a,b);this.animate();return c};j.prototype.serialize=function(){return this.root.serialize()};j.prototype.animate=function(){var a=this;if(a.options.timeout!=0){var b=a.editing==!0?1.5:a.options.timeout;clearTimeout(a.moveTimer);a.moveTimer=setTimeout(function(){a.movementStopped=!0},b*1E3)}if(!a.moving)a.moving=!0,a.movementStopped=!1,a.animateLoop()};j.prototype.animateLoop=function(){var a=this;this.canvas.clear();for(var b=0;b<this.lines.length;b++)this.lines[b].updatePosition();this.root.findEquilibrium()||
View
40 custom-style.css
@@ -1,29 +1,31 @@
body {
- background:blue;
+ background:blue;
}
.buzzmap-active div.node {
- color:white;
- font: 30px/34px Arial, sans-serif;
- font-size:1em;
- background:red;
- opacity:0.9;
- border: 2px solid orange;
- -webkit-border-top-left-radius: 20px;
- -webkit-border-bottom-right-radius: 20px;
- -moz-border-radius-topleft: 20px;
- -moz-border-radius-bottomright: 20px;
- border-top-left-radius: 20px;
- border-bottom-right-radius: 20px;
-
+ color:white;
+ font: 30px/34px Arial, sans-serif;
+ font-size:1em;
+ background:red;
+ opacity:0.9;
+ border: 2px solid orange;
+ -webkit-border-top-left-radius: 20px;
+ -webkit-border-bottom-right-radius: 20px;
+ -moz-border-radius-topleft: 20px;
+ -moz-border-radius-bottomright: 20px;
+ border-top-left-radius: 20px;
+ border-bottom-right-radius: 20px;
}
.buzzmap-active div.node a {
- color:#fff;
+ color:#fff;
}
.buzzmap-active div.node.active {
- padding:5px 10px !important;
- border-width:5px !important;
- color:#fff!important;
+ padding:5px 10px !important;
+ border-width:5px !important;
+ color:#fff!important;
}
.buzzmap-active div.node.active a {
- color:#fff;
+ color:#fff;
+}
+.buzzmap-active div.node.root {
+ font-size:2em;
}
Please sign in to comment.
Something went wrong with that request. Please try again.