JamesFT / blockly

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

Blocks become disconnected from parent block when parent is collapsed #173

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.In the "Code" app, use an "if-then-else" block
2.Attach an "if-then" block in the "if" part of the main "if-then-else"
3.Attach an "if-then" block in the "else" part of the main "if-then-else"
4.Collapse the main "if-then-else" block and go to the XML tab
5.Return to the blocks tab

What is the expected output? What do you see instead?
The child "if-then" blocks have become "disconnected" from the parent 
"if-then-else" block and are overlaying it.

What browser are you using?
Firefox

Please provide any additional information below.

Original issue reported on code.google.com by gawat...@gmail.com on 22 Oct 2013 at 3:39

GoogleCodeExporter commented 9 years ago
Confirmed.  Looks like the fix is as simple as reversing the order of creating 
blocks and collapsing them in the XML parser.

Original comment by neil.fra...@gmail.com on 8 Jan 2014 at 7:38

GoogleCodeExporter commented 9 years ago
Fixed in r1597.

Original comment by neil.fra...@gmail.com on 10 Jan 2014 at 8:44

GoogleCodeExporter commented 9 years ago
Hi Neil,

after updating our Blockly core to the latest svn (containing this fix) we 
experienced a strange problem where some blocks become visually disconnected 
from their parents once loaded from xml.

I tracked it down and have been able to reproduce it with the smallest subset 
of blocks I could, you can find it here:

https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#hm983w

Note that the blocks are in fact connected, you can collapse/expand the outer 
if to see them correctly lined up.

I'm commenting on this issue because, as you can see, the problem arises when 
there are some collapsed blocks attached here and there.

So I digged around and found a possible solution (works for me), it seems that 
moving the bulk of the code that collapses a block before rendering the block 
itself (line 346 on xml.js) fixes this issue.

I attached a small diff, I'm sure this may break other things I'm not aware of 
so, please, handle with care. :-)

Original comment by mich...@enuan.com on 20 Jan 2014 at 3:28

Attachments:

GoogleCodeExporter commented 9 years ago
Yikes.  I just spotted your message while doing an end of quarter review.  
Thanks for the great report and excellent patch.

Fixed.  Again.

Original comment by neil.fra...@gmail.com on 3 Apr 2014 at 10:06