google / blockly

The web-based visual programming editor.
https://developers.google.com/blockly/
Apache License 2.0
12.5k stars 3.71k forks source link

Block Bumping for Mutators #833

Open vicng opened 7 years ago

vicng commented 7 years ago

Block bumping needs to be fixed for mutator blocks so that a mutator block always bumps other blocks (and never itself) while it's being mutated.

The problem is illustrated in the following gif:

add117b4-1f26-4382-9438-82e304f7708f

rachel-fenichel commented 7 years ago

This is actually an issue with how bumping interacts with shadow blocks, rather than with mutators.

You can repro this without a mutator: drag a sum block over an if input so that one of the shadows lines up with the input.

vicng commented 7 years ago

I think it's fair game to bump any block after a block has been dragged, since the user was actively changing its position. (There is a question however of which block should appear above the other.)

When a block is being mutated, it shouldn't move since it isn't being dragged around.

RoboErikG commented 7 years ago

Btw, the blocks don't have to be shadows. This code path is hit any time a child block's output conflicts since the child is considered inferior and gets bumbed away (taking its parent with it).