This commit makes the following changes:
1. Improves the mutator code for use under the App Inventor blocks
rendering algorithm which walks the blocks tree starting from a given
node. Iterating over children resulted in an O(n^2) performance.
2. Prevents events from firing when the mutator is first opened, which
prevents superfluous rerendering operations before any changes have
been made by the user.
3. Defers resizing the mutator workspace on every block change to only
occur once at the end of the current JavaScript execution context via
setTimeout().
Fixesmit-cml/appinventor-sources#959
1. Set lastBlockCreated only if the flyout is not a mutator flyout.
2. Only hide workspace scrollbars for the drawer and backpack are
opened, not mutator workspaces.
3. Terminate the flyout's drag operations immediately before creating
a new block.
4. Catch any exceptions in Flyout.prototype.hide that might prevent
proper clean up of the event listeners.
Some App Inventor users were reporting issues where multiple blocks
were being created when dragging from the flyout. This commit adds a
lastBlockCreated field on the flyout that is used to detect whether a
creation operation has occurred since the last time the flyout was
opened. This field is cleared as part of clearOldBlocks_, which is
called during each show operation.
FieldTextInput was not triggering a Change event and this prevented an
onWorkspaceChanged event from firing in the BlocklyPanel. This commit
separates the semantics of the text and value getter/setters so that
updates to the text in onHtmlInputChange handler do not prevent an
event being triggered in setValue() after the user commits the change.
When a Blockly workspace has not been rendered for the first time,
e.g. due to Firefox SVG exceptions, the comment bubbles do not have a
canvas to attach to. This fix sets a `visible` field on the comment
object during load of a Blockly workspace that can be used to trigger
an SVG update once the workspace has been rendered.