scratchfoundation / scratchfoundation/scratch-blocks

Selected block not cleared after dragging a block

Open
#892 5 comments 0 reactions 1 assignee View on GitHub

@rachel-fenichel is already working on this.

Since May 25, 2017.

Dominant language
JavaScript
Stars
2.8k
Forks
1.6k
Avg merge
4h 51m
Merged PRs (30d)
12

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.