Mr-Jpelaez / blockly

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

Request: Add functionality to collapse/expand all blocks #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Currently there is no way to expand/collapse all blocks.
2. Currently when you collapse a block, all information on the block 
disappears, including its title row. It would be better if the collapsed block 
retained its title to distinguish it from other collapsed blocks.

Please provide any additional information below.

The Blockly instance posted at 
http://turing.cs.trincoll.edu/~ram/blockly/apps/code/en.html  illustrates the 
revised feature.   Right-click on the background to bring up the context menu, 
which contains 'Collapse/Expand All' options.  RIght-click on a block to 
collapse it.

A patch file is attached.  The patch replaces the current collapse behavior 
with the proposed behavior.  I can revise the patch to preserve the current 
behavior if that is desirable.

Original issue reported on code.google.com by ram8...@gmail.com on 5 Apr 2013 at 7:58

Attachments:

GoogleCodeExporter commented 8 years ago
Looks promising.  However, collapsing the math + block needs work.

Original comment by neil.fra...@gmail.com on 5 Apr 2013 at 9:10

GoogleCodeExporter commented 8 years ago
I'll fix that and post a revised patch.  I've also been working on other
context menu options -- i.e., arrange blocks in various patterns, sorting
by size and category.  See examples here:
http://turing.cs.trincoll.edu/~ram/blockly/apps/code/en.html

These changes are intended to make it easier to use App Inventor though its
too-small iframe.  Should I submit these for review when they're done?

-- ralph

Original comment by ram8...@gmail.com on 6 Apr 2013 at 8:40

GoogleCodeExporter commented 8 years ago
Absolutely!  There's some people at MIT who would be interested in this.  
Adding Andrew McKinney.

Original comment by neil.fra...@gmail.com on 7 Apr 2013 at 6:40

GoogleCodeExporter commented 8 years ago
Oh, Ellen just pointed out that you are in fact the "people at MIT who would be 
interested in this".  :)  Removing Andrew McKinney.

I've added you as a contributor so we don't need to fiddle with patches.  Just 
submit your code for review before committing:
http://code.google.com/p/blockly/wiki/ContributingCode

Original comment by neil.fra...@gmail.com on 7 Apr 2013 at 6:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This patch should handle the '+' operator and other special cases ('is empty', 
'is divisible by', etc.).   

A test instance is installed here:   
http://turing.cs.trincoll.edu/~ram/blockly/apps/code/en.html

I will also try to submit this through the code review process.

Original comment by ram8...@gmail.com on 9 Apr 2013 at 11:32

Attachments:

GoogleCodeExporter commented 8 years ago
The attached patch addresses this code review: 
https://codereview.appspot.com/8571043/.

In block.svg  I was able to eliminate the reference to 'is' (good catch), but 
don't see any way to drop the references to 'OP'.  Here's what the revised code 
would look like:

      // Special cases 'OP' and 'PROPERTY' blocks and 'is empty' block.                                                                                                                                             
      titleElement.style.display = (title.name == 'OP' ||
        title.name == 'PROPERTY' || title.name == undefined) ? 'block' : display;

The 'undefined' case handles the 'is empty' text block, which has no title.name.

In the process of testing these revisions I discovered that copy_ and 
duplicate_ fail on collapsed blocks in some cases. So I modified both of those 
functions but the solution is not perfect in the case of copy_. In that case 
the fix pastes the copied (collapsed) block an expanded block rather than as a 
collapsed block. The problem when pasting a collapsed block is that the block's 
title is not transformed and translated properly because the drawing functions 
do not call 'renderTitles' during 'paste'.  The reason is that the collapsed 
block has no inputRows.  But I couldn't figure out how to remedy that. This 
problem doesn't arise in the current version of Blockly because titles are not 
displayed on collapsed blocks. 

Original comment by ram8...@gmail.com on 7 May 2013 at 12:18

Attachments:

GoogleCodeExporter commented 8 years ago
Merged as r861.

Original comment by ram8...@gmail.com on 14 May 2013 at 4:48

GoogleCodeExporter commented 8 years ago
How can I create a blockly and how can I add some functionality to it?? 

Original comment by kyathamp...@gmail.com on 19 Dec 2014 at 12:49