pgdad / canviz

Automatically exported from code.google.com/p/canviz
0 stars 0 forks source link

Suggest drawing nodes after edges in class CanvizGraph #76

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I’ve encountered a problem rendering the attached dot file. I was hoping  to 
be able to click on all nodes to raise a  prompt() which is intercepted in my 
application. You will see for many nodes (e.g. the UIWebView) this is not 
possible. This seems to be due to the event being stolen by an overlapping 
bounding div of a bezier line/arrow/egde path connecting some other two nodes. 
Put another way the bounding boxes of the connecting arrows are stealing the 
events from the <a> element in the node label as they are rendered after.

If you render the attached file it should be evident what I mean. The solution 
is to draw the “nodes" after the “edges" so they get priority on events in 
function CanvizGraph.draw :

--- canviz.js   2014-05-26 18:07:19.000000000 +0100
***************
*** 399,405 ****
    },
    draw: function($super, ctx, ctxScale, redrawCanvasOnly) {
        $super(ctx, ctxScale, redrawCanvasOnly);
!       [this.subgraphs, this.nodes, this.edges].each(function(type) {
            type.each(function(entity) {
                entity.draw(ctx, ctxScale, redrawCanvasOnly);
            });
--- 399,405 ----
    },
    draw: function($super, ctx, ctxScale, redrawCanvasOnly) {
        $super(ctx, ctxScale, redrawCanvasOnly);
!       [this.subgraphs, this.edges, this.nodes].each(function(type) {
            type.each(function(entity) {
                entity.draw(ctx, ctxScale, redrawCanvasOnly);
            });

Original issue reported on code.google.com by johnno1...@googlemail.com on 26 May 2014 at 5:42

Attachments: