Author: tim.bunce
Date: Tue Jun  9 14:44:37 2009
New Revision: 766

Modified:
    trunk/bin/nytprofhtml
    trunk/lib/Devel/NYTProf/js/js-treemap/DivTreeMap.js

Log:
Improve treemap look and behaviour.


Modified: trunk/bin/nytprofhtml
==============================================================================
--- trunk/bin/nytprofhtml       (original)
+++ trunk/bin/nytprofhtml       Tue Jun  9 14:44:37 2009
@@ -756,8 +756,9 @@
          backButton.disabled = true;

          map.onMouseOver = function( node ) { infoBox.innerHTML =  
node.toString(); };
-        map.onMouseOut = function( node ) { infoBox.innerHTML = ""; };
+        map.onMouseOut  = function( node ) { infoBox.innerHTML = " ";  
};
          map.onZoomClick = function( node ) { map.zoom();  
backButton.disabled = false; }
+        map.onBoxClick  = function( node ) { map.zoom();  
backButton.disabled = false; }
          backButton.onclick = function() { backButton.disabled = ( 0 ===  
map.unzoom() ); };

          // Define & plug in a resize hook

Modified: trunk/lib/Devel/NYTProf/js/js-treemap/DivTreeMap.js
==============================================================================
--- trunk/lib/Devel/NYTProf/js/js-treemap/DivTreeMap.js (original)
+++ trunk/lib/Devel/NYTProf/js/js-treemap/DivTreeMap.js Tue Jun  9 14:44:37  
2009
@@ -126,14 +126,15 @@
                if( this.shader ) label.style.color = 
this.shader.getForeground( level );
                this.rootDIV.appendChild( label );              
                
-               // The magic heuristic: if the box label is too big - don't 
render the  
box at all
                // Get the width/height of the label - is it larger than the 
destined  
cell?
                if( label.clientWidth + DivTreeMap.LEFT_MARGIN > coords.width 
||  
label.clientHeight > coords.height )
                {
-                       // label.client* are not set until after they're 
parented, so we have  
to do this at least once
-                       this.rootDIV.removeChild( box );
-                       this.rootDIV.removeChild( label );
-                       continue;
+                        // a simple strategy that yields good results is to
+                        // simply stop using labels when the box is too  
small.
+                        // The user still sees the boxes (and thus their  
relative sizes)
+                        // and hovering over them will trigger the  
onMouseOver
+                        // callback that typically shows useful  
information.
+                        label.innerHTML = ""; // empty, zero height and  
width for label
                }
                
                // Recurse into the child node - if sensible

--~--~---------~--~----~------------~-------~--~----~
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to