Skip to content

Selected block not cleared after dragging a block #892

Open
@brassaro

Description

@brassaro

Expected Behavior

After dragging a block (either from the flyout or on the workspace), the 'selected' block (Blockly.selected) should be cleared. This means that clearing the 'selected' block should be done on mouse up.
Using this, every time a block is picked up on, an 'ui' event is created and can be acted upon.

Actual Behavior

After dragging a block, the 'selected' block is not cleared. The value of Blockly.selected is still the last block dragged, until a new block is selected or a mouse down event happens.
Currently, since the 'selected' block is not cleared, when dragging a block for the 2nd time in a row (without interacting with anything else in the meantime), no 'ui' event is created, and so it is not as easy as it should to detect that this block was picked up.

Steps to Reproduce

  1. Launch tests/vertical_playground.html in your browser
  2. Enable Log Events option
  3. Drag a block from the flyout to the workspace
  4. Notice that 3 events are logged: "Create" (when the dragged block is created); "Ui" (when this new block is selected); "Move" (when the block is set on the workspace)
  5. Without clicking anywhere else first, drag the block again from the workspace to some other position on the workspace
  6. Notice that only a "Move" event is logged, while we would except a "Ui" event first

Operating System and Browser

Mac OS 10.11.6 Chrome 58.0.3029.110 (64-bit)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions