Commits

Ian George committed 4503a09

Minor change to stop ugly unstyled links appearing on load

Comments (0)

Files changed (3)

 - Sorted out the colour issues, light backgrounds and dark text now work properly
 - z-indexing is now working properly for dark on light
 
+0.4.2
+- forgot to rebuild the minified version
+
+0.4.3
+- tied rotation to mouse vector so movement is consistent across browsers with lower mouse event rates
+
+0.4.4
+- minor update to stop ugly unstyled links appearing on load
   zoom              75                 Initial zoom level
   min_zoom          25        
   max_zoom          120      
-  zoom_factor       () 2               Speed of zoom by the mouse wheel
-  rotate_by         -1.75              In degrees, the amount that the sphere rotates. Negative values reverse the direction.
+  zoom_factor       2                  Speed of zoom by the mouse wheel
+  rotate_factor     0.45               In degrees, the amount that the sphere rotates. Negative values reverse the direction.
   fps               10                 Defines the (target) number of times the animation will be updated per second
   centrex           250                Horizontal rotation centre in the container <div>
   centrey           250                Vertical rotation centre in the container <div>
          min_font_size: 12, //font limits and units
          max_font_size: 32,
          font_units: 'px',
-         //uncomment to override the background-color and color css props from the container
-         //background_colour: '#000',
-         //foreground_colour: 'rgb(255,255,255)',         
          random_points: 0         
      };
 
                                        if(sz > points.largest) points.largest = sz;
                                        if(sz < points.smallest) points.smallest = sz;
 
-                                       container.append('<div id="'+ id_stub + idx +'" class="point" style="position:absolute;"><a href=' + $(this).attr('href')  + '>' + $(this).html()  + '</a></div>');
+                                       container.append('<div id="'+ id_stub + idx +'" class="point" style="position:absolute;display:none;"><a href=' + $(this).attr('href')  + '>' + $(this).html()  + '</a></div>');
                                    });
 
          //if required to do so (by opts.random_points being > 0) we need to generate some random points on the sphere
          //set up initial view
          depth = -(zoom * (eyez - opts.max_zoom) / 100) + eyez;
          moved(cmx, cmy);
+         draw();
+
+         //show all the points
+         $('.point',container).css('display','inherit');
+
 
          //call draw every so often
          drawing_interval = setInterval(draw, opts.drawing_interval);

jquery.tagsphere.min.js

 points.count=$('li a',container).length;points.largest=1;points.smallest=0;$('li a',container).each(function(idx,val){var sz=parseInt($(this).attr('rel'));if(sz==0)
 sz=1;points.data[idx]={id:id_stub+idx,size:sz};var h=-1+2*(idx)/(points.count-1);points.data[idx].theta=Math.acos(h);if(idx==0||idx==points.count-1){points.data[idx].phi=0;}
 else{points.data[idx].phi=(points.data[idx-1].phi+3.6/Math.sqrt(points.count*(1-Math.pow(h,2))))%(2*Math.PI);}
-points.data[idx].x=Math.cos(points.data[idx].phi)*Math.sin(points.data[idx].theta)*(cmx/2);points.data[idx].y=Math.sin(points.data[idx].phi)*Math.sin(points.data[idx].theta)*(cmy/2);points.data[idx].z=Math.cos(points.data[idx].theta)*(cmx/2);if(sz>points.largest)points.largest=sz;if(sz<points.smallest)points.smallest=sz;container.append('<div id="'+id_stub+idx+'" class="point" style="position:absolute;"><a href='+$(this).attr('href')+'>'+$(this).html()+'</a></div>');});if(opts.random_points>0){for(b=0;b<opts.random_points;b++){points.count++;points.data[points.count]={id:id_stub+points.count,size:1};points.data[points.count].theta=Math.random()*2*Math.PI;points.data[points.count].phi=Math.random()*2*Math.PI;points.data[points.count].x=Math.cos(points.data[points.count].phi)*Math.sin(points.data[points.count].theta)*(cmx/2);points.data[points.count].y=Math.sin(points.data[points.count].phi)*Math.sin(points.data[points.count].theta)*(cmy/2);points.data[points.count].z=Math.cos(points.data[points.count].theta)*(cmx/2);container.append('<div id="'+id_stub+points.count+'" class="point" style="position:absolute;"><a>.</a></div>');}}
+points.data[idx].x=Math.cos(points.data[idx].phi)*Math.sin(points.data[idx].theta)*(cmx/2);points.data[idx].y=Math.sin(points.data[idx].phi)*Math.sin(points.data[idx].theta)*(cmy/2);points.data[idx].z=Math.cos(points.data[idx].theta)*(cmx/2);if(sz>points.largest)points.largest=sz;if(sz<points.smallest)points.smallest=sz;container.append('<div id="'+id_stub+idx+'" class="point" style="position:absolute;display:none;"><a href='+$(this).attr('href')+'>'+$(this).html()+'</a></div>');});if(opts.random_points>0){for(b=0;b<opts.random_points;b++){points.count++;points.data[points.count]={id:id_stub+points.count,size:1};points.data[points.count].theta=Math.random()*2*Math.PI;points.data[points.count].phi=Math.random()*2*Math.PI;points.data[points.count].x=Math.cos(points.data[points.count].phi)*Math.sin(points.data[points.count].theta)*(cmx/2);points.data[points.count].y=Math.sin(points.data[points.count].phi)*Math.sin(points.data[points.count].theta)*(cmy/2);points.data[points.count].z=Math.cos(points.data[points.count].theta)*(cmx/2);container.append('<div id="'+id_stub+points.count+'" class="point" style="position:absolute;"><a>.</a></div>');}}
 var sz_range=points.largest-points.smallest+1;var sz_n_range=opts.max_font_size-opts.min_font_size+1;for(var p in points.data){var sz=points.data[p].size;var sz_n=parseInt((sz/sz_range)*sz_n_range)+opts.min_font_size;if(!$('#'+points.data[p].id,container).hasClass('background')){$('#'+points.data[p].id,container).css('font-size',sz_n);}
 points.data[p].cwidth=$('#'+points.data[p].id,container).width()/2;}
-$('ul',container).remove();depth=-(zoom*(eyez-opts.max_zoom)/100)+eyez;moved(cmx,cmy);drawing_interval=setInterval(draw,opts.drawing_interval);container.mousemove(function(evt){moved(evt.clientX,evt.clientY);});container.mousewheel(function(evt,delta){zoomed(delta);evt.preventDefault();return false;});};})(jQuery);
+$('ul',container).remove();depth=-(zoom*(eyez-opts.max_zoom)/100)+eyez;moved(cmx,cmy);draw();$('.point',container).css('display','inherit');drawing_interval=setInterval(draw,opts.drawing_interval);container.mousemove(function(evt){moved(evt.clientX,evt.clientY);});container.mousewheel(function(evt,delta){zoomed(delta);evt.preventDefault();return false;});};})(jQuery);