This is a squash and merge of a large set of changes by @BeksOmega
* Added functionality to scrolling, dragging, and zooming.
* Fixed incorrect changes to workspaceChanged function.
* Fixed comment.
* Fixed typo.
* Removed scrollbar.set calls from workspace_svg.
* Removed scrollbar.resize() call.
* Added move options to playground.
* Fixed scroll_ calls that replaced scrollbar.set calls.
* Removed this.scrollbar checks.
* Changed zoom so that it always zooms towards the coordinates. Changed isContentBounded_ to be separate from isMovable_ (b/c of the previous change zoomControls had to be added to the bounded check). Fixed scroll_() calls... again.
* Changed procedures so the Highlight definition option is only available if the workspace is moveable.
* Fixed scrollCenter so that it works with flyout toolboxes.
* Fixed zoomToFit so that it works with horizontal flyout toolboxes.
* Fixed Typo.
* Fixed bumping blocks when the workspace is not movable.
* Fixed bumping not working with left and top toolbox positions.
* Re-Added not allowing scrollCenter if the workspace is not movable. Disabled scrollCenter button for this case.
* Cleaned up formatting.
* Fixed bumping... again. Reformatted workspaceChanged a bit.
* Changed blocks to be completely bumped into the workspace.
* Reorganized metrics-getting for workspaceChanged.
* Added bumping workspace comments. Moved event checking.
* Renamed workspaceChanged to bumpObjects.
* Added a bumpObjects developer reminder.
* Added warning to zoomToFit.
* Cleaned up some text.
* Added better inline documentation.
* Fixed up inline docs.
* Cleaned up comments.
* Fixed zoomCenter not actually zooming towards the center.
* Fixed zoomControls error on unmovable bottom-toolbox workspaces
* Fixed programatically placing blocks in an unmovable workspace.
* Removed unnecessary translate call in inject.
* Reversed removal of translate. (apparently it was necessary)
* Cleaned up code in response to first round of reviews.
* Added unit comments to the zoom function.
* Removed bumpObjectsEventChecker. Added BUMP_EVENTS list to Blockly.Events.
* Changed getWorkspaceObjectMetrics call to getBoundingRectangle().
* Fixed utils.mouseToSvg (was causing problems with zoom on wheel if the page was scrolled).
* Fixed zoom when page is scrolled (actually this time). Reverted changes to utils.mouseToSvg.
* Fixed centerOnBlock.
* Added unit docs to translate. Moved setting the grid position to the translate function.
* Added TODO's.
Fixes#1653
Makes the bounds checker created in inject correctly set the event group
before moving blocks in bounds.
When a workspace can't scroll the inject method sets up an event listener
to bump blocks back into the visible bounds when dropped off the edge. The
event group wasn't being used, though, causing the move to be a separate
undo step. When undone, this would get you stuck in a loop where the
workspace would keep pulling it back into the visible range.
* Making all blocks use the MSG colour values.
* Deprecating Blockly.Constants.Lists.HUE and similar constants.
* Removing deprecated Blockly.Blocks.lists.HUE constants.
* Allowing message references in the Block.setColour() parameter.
* Adding checking of older constants, ensuring they are not overwritten.
* Add block drag surface translateSurfaceBy
* Add dragged connection manager
* Add gesture.js
* Add GestureHandler
* Implemented gesture skeleton
* Most basic workspace dragging
* Add dragged connection manager
* cleanup
* doc
* more cleanup
* Add gesture handler
* Add translateSurfaceInternal
* core/block_dragger.js
* cleanup
* Pull in changes to dragged connection manager
* Pull in changes to dragged connection manager
* comments
* more annotations
* Add workspace dragger
* Add coordinate annotations
* Start on block dragging
* Limit number of concurrent gestures
* Add some TODOs
* start using dragged connection manager
* Set origin correctly for dragging blocks
* Connect or delete at the end of a block drag.
* cleanup
* handle field clicks and block + workspace right-clicks
* move code into BlockDragger class, but still reach into Gesture internals a lot
* Clean up block dragger
* Call blockDragger constructor with correct arguments
* Enable block dragging in a mutator workspace
* Add workspace dragger
* click todos
* Drag flyout with background
* more dragging from flyout
* nit
* fix dragging from flyouts
* Remove unused code and rename gestureHandler to gestureDB
* Rename gesture handler
* Added some jsdoc in gesture.js
* Update some docs
* Move some code to block_svg and clean up code
* Lots of coordinate annotations
* Fix block dragging when zoomed.
* Remove built files from branch
* More dragging work (#1026)
-- Drag bubbles while dragging blocks
-- Use bindEventWithChecks to work in touch on Android. Not tested anywhere else yet.
-- Handle dragging blocks while zoomed
-- Handle dragging blocks in mutators
-- Handle right-clicks (I hope)
-- Removed lots of unused code
* More dragging work (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- Get rid of flyout.dragMode_ and blockly.dragMode_
- Make drags from the flyout start from the top block in the group
- Block tooltips from being scheduled or shown during gestures
- Don't resize mutator bubbles mid-drag
* Fix events in new dragging (#1060)
* rebuild for testing
* unbuild
* Fix events
* rebuild
* Fix up cursors
* Use language files from develop
* Remove handled TODOS
* attempt to fix IE rerendering bug, and recalculate workspace positions on scroll
* Rebuild all the things
* Comment cleanup; annotations; delete unused variables.
* Cross browser friendly fix for #904. This calls blur and focus from workspace.markFocused and removes the event listener on focus events. markFocused is called from all of our mouse down handlers, which triggers the focus event leading to an infinite loop of focus. As far as I can tell, there are no uses of the focus handler that actually did anything for us.
* Add a workspace drag surface that blocks and bubble get moved to during a workspace drag.
The surface is translated using translate3d instead of svg's translate attribute so that
the browser does not have to repaint the entire workspace on every mouse move.
This is very similar to the block drag surface.
* Address code review comments
* add back hasClass_ utility removed in #748 and stop using contains since it is not supported in IE
* Split the scrollbar and flyout out into their own SVG elements. They
are siblings of the workpsace SVG. This paves the way to make performance
improvements to workspace dragging.
Improve performance of block dragging. This is a backport of the block drag surface from scratch-blocks. At the beginning of a block drag, blocks get moved to a drag surface which then translates using translate3d to avoid repainting the entire svg on every mouse move. At the end of the drag, the blocks are dropped back in the svg in their new position.
* * apply bootstrap3 integration fixes
* Injection subcontainer
Include svg and div into a master container, which allow css better
positioning (overflow scrolling problem)
* * Fix toolbox positioning (rtl and ltr). Because toolbox if relative to injection div, only adjust it to left (ltr) or right (rtl) edge
* * fix style (thanks to @NeilFraser)
* * revert msg files
* 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.