Hareeshchandera / jsplumb

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

Cannot add endpoint when containing DIV has display:none #108

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
See the attached test case. When adding an endpoint to an element that is 
inside an invisible DIV (display:none), I get a error:

element.canvas.offsetParent is null

at jquery.jsPlumb-1.3.1-all.js:1923.

Tested with jsPlumb version 1.3.1 on Firefox 5. Chrome has the same problem, 
but reports a slightly different error message:

Uncaught TypeError: Cannot read property 'tagName' of null

The reason for drawing on an invisible DIV is that my app has multiple 
diagrams, only one of which will be visible at any one time. On initial load, 
each diagram is drawn. Then, tabs can be used to switch between the diagrams.

Original issue reported on code.google.com by eel...@xs4all.nl on 25 Jul 2011 at 8:51

Attachments:

GoogleCodeExporter commented 8 years ago
it seems like a reasonable use case, ha.

this is a dupe of issue 110 (or rather, to be fair, 110 is a dupe of this).  
like i just said over on 110, right now i don't have any thoughts on what i can 
do about this.

Original comment by simon.po...@gmail.com on 26 Jul 2011 at 6:30

GoogleCodeExporter commented 8 years ago
Thanks. I will have to find a workaround for this in my application; the
bug is a show stopper for me.
A workaround should not be too difficult. Something along the lines of
deferring painting the diagram until it is actually shown for the first
time. After that, swapping between display:block and display:none should
be fine. All user interaction (adding nodes, adding connectors) will
only happen when the DIV is visible, so from that point onwards it will
be OK. It is just the initial loading of the diagrams that has an issue.
At least in my application.

Original comment by eel...@xs4all.nl on 26 Jul 2011 at 7:49

GoogleCodeExporter commented 8 years ago
it seems likely that most people use case will be like yours: things only 
really change when the container div is visible.  of course it's entirely 
possible that people will also want to programmatically change a diagram that 
is not visible.

i just got home and i'm gonna get a bit to eat then i'll take a look at this.  

Original comment by simon.po...@gmail.com on 26 Jul 2011 at 8:27

GoogleCodeExporter commented 8 years ago

Original comment by simon.po...@gmail.com on 28 Jul 2011 at 3:19

GoogleCodeExporter commented 8 years ago
i just merged this into issue 110.

Original comment by simon.po...@gmail.com on 28 Jul 2011 at 3:20