google / blockly-samples

Plugins, codelabs, and examples related to the Blockly library.

Home Page:http://github.com/google/blockly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resetting the workspace state when entering data in num and funcs

bbrudastyy opened this issue · comments

Check for duplicates

  • I have searched for similar issues before opening a new one.

Component

workspace Minimap

Description

The problem is in the mirror method of the Minimap class in the first check with early return. When entering data into the num block, Blockly sends 3 consecutive events starting with the (-) sign. change, inter..., change. Because of this, mirror makes an early return and the application stops working correctly when trying to enter a negative number further. The same situation occurs when trying to change the name of a function, when the block for calling this function is also located on the workspace

Reproduction steps

For NUM

  1. Initialize the minimap library
  2. Launch the application
  3. Add the num block to the workspace
  4. Enter (-) in the field of the num block
  5. To see that the ability to enter values further stops

For funcs

  1. Initialize the minimap library
  2. Launch the application
  3. Add a block of functions
  4. Add a call to this function
  5. Try to change the name of the function

Stack trace

-

Screenshots

No response

I think this is most likely caused by google/blockly#7966 and if we fixed that issue in core this would go away.

Thanks for filing this! If you're interested in contributing a fix we'd accept a PR in core for this :)

I couldn't replicate the bug with entering a (-) sign in the number field but typing a letter in the field prevented me from entering further characters, which sounds similar to the above description. I was able to replicate the bug with changing a function name, it stopped letting me add input after the first character.

I linked against the latest commit of blockly/develop using the directions in #2035 (comment) and this appeared to fix the number field bug, but not the function name bug. I'll investigate further.

Thanks for confirming! The function name bug is tracked in #2131 I've assigned you to that.

I'll close this since you confirmed the fix in core resolves this. Thanks!

Reopening because it's only half fixed! The procedure renaming bug is still present.

I think the problem is that when a procedure name is edited, the call blocks are also renamed. The edits to the procedure name are correctly fired as intermediate events, but the change to the call block is fired as a block change event, which is causing the problem where I can't keep typing in the open field input widget.

EDIT: Maybe the best option would be for the changes to the call block names to be fired as intermediate events as well, and then when the changes to the procedure block are confirmed with a block change event, then we should also fire block change events confirming the changes to the call blocks. Otherwise, every character entered in the procedure block field would result in change events (from the call blocks) which is what we were trying to avoid with the intermediate event feature.

I closed it because there is a separate bug open for the procedure renaming bug which I assigned you to, #2131

your last comment sounds reasonable to me!