Add a isMutator member similar to isFlyout to workspace_svg so it knows whether
it is mutator or not. Allow blocks to access that property so that they can recalculate
coordinates appropriately.
screen transformation matrix) when a scroll happened.
This is not done using a scroll handler since the update
is expensive (getScreenCTM and getClientBoundingRect) and we don't need to do it
until the scroll is done and the user is interacting with blocks again.
We also have to record startFlyout_ on background scrolls - before
dragMode_ wasn't being reset by terminateDrag() for background scrolls,
which would suppress clicks from that point on.
Fixes#476.
* Record whether the workspace has been dragged
This fixes#473 by differentiating between a touch on an unmovable block
and using it to drag the workspace.
* Remove isScrolling and add DRAG_BEGIN
Applied after PR review.
This comment made sense [before multiple workspace support](67140282a0/core/blockly.js (L297)), where it was near a (Blockly.readOnly || isTargetSvg) check. Now, this logic is implemented in BlockSvg.onMouseDown_() instead.
This includes both block drags and workspace scrolls and fixes#404. I
used isDragging rather than checking the origin of click so that it can
easily be extended to the case where the flyout is scrolled by dragging
a block, a la LLK/scratch-blocks#206.
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86 changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
from getting selected. Use e.preventDefault instead of adding and removing
classes on mousedown and mouseup. This keeps the browser from having to
potentially recacluate style on mousedown and mouseup events.