Commit graph

141 commits

Author SHA1 Message Date
Rachel Fenichel
df1b765384 Create block differently from autoclosing flyout 2016-07-12 15:34:20 -07:00
Rachel Fenichel
3202fcbd0c Fix connection disposal and get rid of startFlyout_ 2016-07-12 15:15:35 -07:00
Rachel Fenichel
8e652db9fe Merge branch 'develop' of https://github.com/google/blockly into feature/pull_google/7_11 2016-07-11 15:53:14 -07:00
Neil Fraser
e849c93db9 Merge branch 'master' into develop 2016-07-08 16:52:18 -07:00
Rachel Fenichel
c79f4929dd Add json property for adding a checkbox in the flyout 2016-06-29 13:38:07 -07:00
rachel-fenichel
ef283c8537 Merge pull request #452 from rachel-fenichel/feature/checkboxes_in_flyout
Checkboxes in the flyout
2016-06-29 13:18:12 -07:00
Rachel Fenichel
6e0c4ef80a Prevent default on checkbox click. 2016-06-29 13:17:45 -07:00
Rodrigo Queiro
589f6ae13f Re-enable events even when an exception is thrown
This prevents a recoverable exception permanently disabling events. This
could be caused by calling domToWorkspace() to load a corrupt program.
2016-06-29 14:46:06 +02:00
Rodrigo Queiro
0454c93ff8 Clean up #417 after review 2016-06-29 12:26:11 +02:00
Rodrigo Queiro
4e3faf0158 Revise handling of mouse events on flyout blocks
- allows scrolling by dragging a block up and down
- dragging a block towards the workspace creates it
- dragging a block any direction in a non-scrollable flyout creates it
- dragging a shadow block works properly
- clicks on fields in non-closeable flyouts always open editors
- clicks in closeable flyouts create the block but don't open editors

Fixes #385 and fixes #405.
2016-06-29 11:29:03 +02:00
Rodrigo Queiro
2dcb6cb68b Ignore mouseup at end of drag with isDragging (#416)
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.
2016-06-28 18:11:48 -07:00
rachel-fenichel
aca074891d Fix some problems with flyout rendering (#461) 2016-06-27 17:27:08 -07:00
Rachel Fenichel
6539a634b6 Fix lots of small things in flyout.js 2016-06-24 14:32:58 -07:00
Rachel Fenichel
9fa9fd93c6 Merge branch 'develop' into feature/checkboxes_in_flyout 2016-06-23 16:14:41 -07:00
Tim Mickel
d98844de34 Getters for getters for workspace's flyout and flyout's workspace; give blocks unique ID from flyout blocks (#450) 2016-06-23 18:17:36 -04:00
Tim Mickel
ca3275eaf0 Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.

* test page that creates random blocks and randomly drags them around the page

* Localisation updates from https://translatewiki.net.

* add missing return in fake drag

* get rid of drag_tests file:

* Generated JS helper functions should be camelCase.

Complying with Google style guide.

* Localisation updates from https://translatewiki.net.

* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.

* Remove claim that good.string.quote should be used.

* Change the blockly workspace resizing strategy. (#386)

* 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.

* Routine recompile

* Fix unit tests.

* Fix inheritance on rendered connection.

Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.

* Add toolbox location and toolbox mode options to playground.

* Increase commonality between playgrounds.

* Properly deal with shadow statement blocks in stacks.

* Localisation updates from https://translatewiki.net.

* Use a comment block for function comments in generated JS, Python and Dart.

* Fix typo in flyout.js (#403)

* Fix typo in flyout.js (#402)

* Line wrap comments in generated code.

* Remove reference to undefined variable (#413)

REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.

* Fix airstrike by grabbing the correct toolbox element. (#411)

Probably broken in 266e2ffa9a.

* Localisation updates from https://translatewiki.net.

* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)

* Remove shadow blocks from Accessible Blockly demo. Update README.

* Generate for loops on one line.

* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.

* Fix precedence on isIndex blocks.

* Add indexing setting for JavaScript Generation (#419)

Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.

* Remove unused functions and dependencies.

* Remove the unnecessary construction of new services.

* Fix sort block in JS to satisfy tests.

* Trigger a contents resize in block's moveBy. (#422)

This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.

* Consolidate the usages of the 'blockly-disabled' label.

* Fix error when undoing a shadow block replacement.  Issue #415.

* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.

* Standardize naming of components.

* Prevent collisions between user functions and helper functions.

* Localisation updates from https://translatewiki.net.

* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)

when workspace.dispose() is called.

* Change the TreeService to a singleton.

* Remove unneeded generated parens around function calls in indexOf blocks.

* Fix #423 by calling workspace's resize when the flyout reflows. (#430)

* Updating URLs to reflect new docs. (#418)

* Updating URLs to reflect new docs. Removing -blockly in URLs.

* Rebuilt.

* Routine recompile

* Prevent selected block from ending up underneath a bumped block.

* Fix undo on fields with validators with side effects.

* Don't fire change event on fields that haven't been named yet.

* Localisation updates from https://translatewiki.net.

* Fix tree focus issues.

* Fix remaining focus issues on block deletion.

* cache delete areas instead of recalculating them onMouseDown

* Cache screen CTM for performance improvement.

* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)

from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.

One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.

* Allow terminal blocks to replace other terminal blocks (#433)

* Allow terminal blocks to replace other terminal blocks

* Updated test to allow replacing terminal blocks

* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.

* Localisation updates from https://translatewiki.net.

* Remove unnecessary logging.

* Reduce unneeded parentheses in JS and Python.

* Start using field_number.

* Make it easy to disable unconnected blocks.

* Routine recompile.

* Check if matrix is null in mouseToSvg

* Remove js/ localizations pre-merge

* Fix change to block_render_svg

* Fix error in xml.js

* Playground merge

* Add simple toolboxes to playgrounds

* Fix flyout reference in events listener

* Move tokenizeIntepolation into Blockly.utils namespace.

* Use simpler message interpolation in Code demo.

* Create console stub for IE 9.

* Don't output blockId if not set (e.g., toolbox category event). (#443)

* Fix block in multi-playground

* Increase commonality between playgrounds.

# Conflicts:
#	tests/multi_playground.html
#	tests/playground.html

* Remove "show flyouts" button

* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
Tim Mickel
f1c7cae728 Remove maxBlocks (fix #309) (#435)
* Remove `maxBlocks` (fix #309)

* Also remove filterForCapacity_

* More references to remainingCapacity
2016-06-21 15:54:03 -04:00
Rachel Fenichel
8f601345bb cache delete areas instead of recalculating them onMouseDown 2016-06-17 12:39:18 -07:00
picklesrus
33ba6e8fad Fix #423 by calling workspace's resize when the flyout reflows. (#430) 2016-06-14 10:13:03 -07:00
Rachel Fenichel
4139656a7a first pass at checkboxes in the flyout 2016-06-09 14:00:40 -07:00
Rodrigo Queiro
0585a667ec Fix typo in flyout.js (#402) 2016-06-07 09:54:57 -07:00
Rodrigo Queiro
736ff96ead Fix typo in flyout.js (#403) 2016-06-07 09:54:37 -07:00
Rachel Fenichel
53d9c6b351 Merge branch 'develop' of https://github.com/google/blockly into feature/pull_upstream_6_01 2016-06-06 11:14:48 -07:00
picklesrus
213469a479 Change the blockly workspace resizing strategy. (#386)
* 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.
2016-06-03 16:11:55 -07:00
Tim Mickel
b385828a43 Vertical shapes pass (#362)
* Add if, if-else, equals; remove old if-elses

* Naming fixes and removal of a dummy input for if-else

* Fix spacing constants; add correct notches.

* Fixing inner notches and connections on vertical statements

* Fix size of extra row after last statement input

* Add minimum block width

* Vertical hat shape to spec

* Larger vertical minimum block width

* Remove INLINE_PADDING_Y and increase MIN_BLOCK_X

INLINE_PADDING_Y, a fixed padding for the internal inputs, shouldn't be necessary in Scratch Blocks. Instead, we'll attempt to center the inputs vertically, and give a padding eventually not for inline inputs but rather for non-shadow blocks in inputs...

* Remove code for horizontal puzzle tabs

* Remove code for "external naked fields"

* Start hats are always on in Scratch Blocks

* Update vertical playground to start at 75%

* Vertical field alignment in vertical rendering

* Increase size of vertical green flag icon

* Minimum width for blocks with C- or E-.

* Remove unused field alignment code

* Fix up inner spacing on statement input

* Fix overhang to avoid clobbering height calculation

* Subtract correct height in getHeightWidth

* Subtract notch height in drawing statement bay

* Add MIN_STATEMENT_INPUT_HEIGHT

* Update size of extra row after statement input

* Don't add extra pixel on statement input connection

* Fix psuedo-height for blocks with no next connection

* Rows after a statement input take the same size as EXTRA_STATEMENT_ROW_Y

* Simplify height management to never include notches

* Consolidate inputRows.rightEdge calculation

* Clean up tab removal

* Fix domToWorkspace in vertical_playground.html

* Render constant newlines

* Updating NOTCH_LEFT_PADDING to NOTCH_START_PADDING

* Update comments about vertical field centering; spacing

* Remove old comment about baseline

* Simplify logic for positioning inline inputs

* Ensure inputs in the first row don't overlap with notch
2016-05-27 13:21:40 -04:00
rachel-fenichel
e14e42192c Merge pull request #379 from rachel-fenichel/cleanup/more_lint
More lint and eslint configuration.
2016-05-25 15:36:03 -07:00
Rachel Fenichel
4841f136f1 More lint and eslint configuration. 2016-05-25 15:35:11 -07:00
Rachel Fenichel
6208ba62fb Rename a variable for clarity 2016-05-25 13:47:19 -07:00
Rachel Fenichel
2f4bc8a0b1 lint fixes 2016-05-24 14:17:43 -07:00
Rachel Fenichel
59e065ae5b Merge branch 'develop' of https://github.com/google/blockly into feature/merge_upstream_horizontal_toolbox 2016-05-23 13:07:11 -07:00
Neil Fraser
29e10e0976 Routine recompile. 2016-05-14 03:50:35 -07:00
Rachel Fenichel
f38b43419c Combine horizontal and vertical flyout scrolling 2016-05-13 16:07:53 -07:00
Rachel Fenichel
65aceaa1dc Fix docstrings and add horizontal scrolling. 2016-05-13 15:30:47 -07:00
Rachel Fenichel
666536807a Add comments; scroll to start for always open flyout 2016-05-13 14:26:32 -07:00
Tim Mickel
2fc4ecd520 Fix deprecated call to domToBlock in flyout 2016-05-12 22:00:34 -04:00
Rachel Fenichel
9073cec9d7 small cleanup after merge 2016-05-12 18:35:45 -07:00
Rachel Fenichel
624a20efdd Merge branch 'develop' of https://github.com/google/blockly into google-blockly/develop 2016-05-12 18:30:42 -07:00
Rachel Fenichel
8cfd48554a clean up margins 2016-05-11 16:40:42 -07:00
Rachel Fenichel
e0cda58701 fix variable naming in createnewblock. 2016-05-11 15:15:12 -07:00
Rachel Fenichel
77a8b92ac2 Merge branch 'develop' into feature/horizontal_toolbox_port 2016-05-11 11:44:38 -07:00
Rodrigo Queiro
8415db4085 Hide dropdowns when scrolling the flyout
Fixes #302. This hides both WidgetDiv and DropDownDiv without animation,
otherwise they can float over other blocks as they're animating out.
2016-05-09 09:03:50 -07:00
Neil Fraser
217c681b86 Use direct call to svg resize rather than event. Also fix issue #296. 2016-05-04 15:00:57 -07:00
Tim Mickel
4feb56c188 Add click events to non-closing flyout blocks. (#310)
* Add click events to non-closing flyout blocks. Issue #337.

# Conflicts:
#	core/flyout.js

* Recompile
2016-05-03 15:43:29 -04:00
Rachel Fenichel
8f51fb1e48 remove duplicate code 2016-05-02 15:23:02 -07:00
Rachel Fenichel
8d539f56f3 Preserve create and delete events in the flyout 2016-04-27 11:33:09 -07:00
Rachel Fenichel
cb1188af45 Add TODOs 2016-04-27 10:31:01 -07:00
Rachel Fenichel
2591e12a46 Fix janky scrolling in vertical case 2016-04-26 18:16:26 -07:00
Rachel Fenichel
60dfbb455e offset correctly when opening for the first time 2016-04-26 15:10:49 -07:00
Rachel Fenichel
9dd2b00074 Avoid some unnecessary calls to resize() 2016-04-26 13:30:27 -07:00
Rachel Fenichel
a27fe99be4 Merge branch 'develop' into feature/horizontal_toolbox_port 2016-04-25 14:25:36 -07:00