Commit Graph

3449 Commits

Author SHA1 Message Date
Beka Westberg
73ff710a4d Added getSourceBlock function to field. (#2508) 2019-05-29 12:50:00 -07:00
Beka Westberg
9099ee8c14 Readded reevaluating values when constraints are set. (#2507) 2019-05-29 12:48:55 -07:00
Neil Fraser
459961c3cb Replace Element constants with Node constants.
Element constants apparently don’t exist in IE or Edge.  Node constants apparently do.
2019-05-29 10:45:54 -07:00
Rachel Fenichel
a03f0859cc Merge pull request #2497 from BeksOmega/fixes/ValidColourFieldValues
Changed Colour Field Class Validator to Accept all Documented Values
2019-05-28 16:07:52 -07:00
translatewiki.net
c8704689e5 Localisation updates from https://translatewiki.net. 2019-05-27 16:33:04 +02:00
Beka Westberg
06c6d83355 Changed colour field class validator to accept all documented values. 2019-05-24 16:14:49 -07:00
Neil Fraser
5c614d73c1 Add tests for XY regexs. 2019-05-24 15:45:05 -07:00
Neil Fraser
9f528922a7 Fix some dependencies 2019-05-24 15:45:05 -07:00
Rachel Fenichel
517f57c182 Merge pull request #2441 from BeksOmega/feature/FieldValidation
Refactored Field Validation.
2019-05-24 14:34:02 -07:00
Beka Westberg
f16c9c0beb Refactored field validation. 2019-05-24 14:23:42 -07:00
Neil Fraser
a4e0091d4e Fix style matching in Firefox 67 (#2485)
Chrome returns ‘transform: translate(107px, 0px);’ whereas Firefox now returns ‘transform: translate(107px);’ if the y value is 0.  This is consistent with existing behaviour in the translate SVG attribute.

The comment in our code specifically states:
// Accounts for same exceptions as XY_REGEX_
Yet that was not true at all.

This PR makes the y argument optional (as falsely described in the comment).  It also merges the 2D and 3D regeps together to simplify the code.

Resolves issue #2482.  Needs to be cherrypicked to Master and everything rebuilt and pushed.
2019-05-24 08:43:22 -07:00
translatewiki.net
52c6efb4f4 Localisation updates from https://translatewiki.net. 2019-05-23 14:08:56 +02:00
translatewiki.net
50cd9c7742 Localisation updates from https://translatewiki.net. 2019-05-20 13:40:27 +02:00
RoboErikG
2386038138 Fix bug with in bounds bumping (#2467)
Traced one cause of Mocha tests sometimes failing to blocks being
bumped back into bounds. It looks like a block being moved to be
a child of another block was ended up out of bounds probably
because the size of the workspace isn't set yet. When the change
handler tried to move it back in it would throw an error since you
can't move child blocks with that method.
2019-05-17 17:57:53 -07:00
Neil Fraser
b10a37a9af Missing semicolon 2019-05-17 16:48:40 -07:00
Neil Fraser
611b2b2300 Routine recompile 2019-05-17 16:48:40 -07:00
Neil Fraser
5cf52c566a Fix a dozen compiler warnings. 2019-05-17 16:48:40 -07:00
Beka Westberg
acd96aa2c5 Added Field Value Tests (#2459)
* Added field value tests.

* Fixed field image src param.

* Fixed falsy values with label fields.

* Fixed falsy values with text input fields.

* Fixed some angle field tests.

* Fixed other text input when editing tests.

* Fixed colour tests.

* Cleaned up some number and variable field tests.

* Added angle field > 360 degrees tests.

* Fixed variable validator tests.

* Split setValue tests into sub-suites.

* Fixed angle >360 tests

* Changed var declarations to property declarations.
2019-05-17 15:19:14 -07:00
Neil Fraser
05253d0766 Add prefix/suffix to orphaned value blocks.
Also respect suppressPrefixSuffix on loops when generating prefix/suffix with continue/break blocks.
2019-05-17 15:04:39 -07:00
Neil Fraser
32631577a4 Defenestration 2019-05-17 15:04:39 -07:00
Neil Fraser
4161ba0fa7 Move goog.global to Blockly.utils.global
Can’t use Blockly.global since that’s the last file to load.
2019-05-17 15:04:39 -07:00
Neil Fraser
25bc3e0268 Fix require statements.
Also throw error instead of string.
And stop using goog.asserts.
2019-05-17 15:04:39 -07:00
Neil Fraser
49954e0cec Remove calls to goog.dom.getViewportSize
document.documentElement.clientWidth/clientHeight seems to work everywhere Blockly works.  Closure’s functions are mind-numbingly complex due to IE5, old WebKit, Opera 8, and others.
2019-05-17 15:04:39 -07:00
Neil Fraser
ed0b5adcd1 Wrong language. 2019-05-17 15:04:39 -07:00
Neil Fraser
e642a77f5d Use conventional prefix/suffix for function calls.
Previously a function call with no return value generated:

  prefix();
  suffix();
  function();

The intent was so the prefix and suffix calls in the function body wouldn’t overlap with the prefix and suffix calls of the function call.  However, this is doomed to be inconsistent with a function call with a return value:

  prefix();
  print(function());
  suffix();

Thus since overlaping must exist, both types of function calls should have consistent suffix locations.
2019-05-17 15:04:39 -07:00
translatewiki.net
475d8eb71f Localisation updates from https://translatewiki.net. 2019-05-17 12:11:24 +02:00
Neil Fraser
04e39c20f8 Fix indentation bug if no xfix exists in function 2019-05-14 17:19:31 -07:00
Neil Fraser
585866a1b6 Revisit function block for return.
Visit (with prefix and suffix) function block when executed.  This commit adds a revisit at the end of the function body when evaluating the return value.
2019-05-14 17:19:31 -07:00
Neil Fraser
c0e14c3a7c Add method to suppress prefix/suffix from blocks.
This allows generators to have more control over the placement of suffix.  Needed for ‘if’ blocks and function calls which require their suffix code to be somewhere other than the end.
Also, add loop’s prefix to ‘break’ blocks, since the loop’s suffix will be the next statement hit.
Also, reuse procedures_callreturn generator for procedures_callnoreturn.
2019-05-14 17:19:31 -07:00
Neil Fraser
25adb40e66 Prefix and suffix edge cases for flow statements.
Call suffix code on break/continue before executing the break/continue.
Call prefix code for enclosing loop before executing continue.
2019-05-14 17:19:31 -07:00
Neil Fraser
0259f8bb48 Add extra suffix when generating if/return block.
Also fix loops in Lua.
2019-05-14 17:19:31 -07:00
Neil Fraser
ba18ae2159 Add STATEMENT_SUFFIX
Also remove need to manually indent INFINITE_LOOP_TRAP.  This is a breaking change for Python users of this property.  However, very few users of this property exist, given that the existing code breaks if the block ID has a $ in it (also fixed in this PR).
2019-05-14 17:19:31 -07:00
Rachel Fenichel
35cbed1584 Merge pull request #2457 from google/fraser-userAgent
Remove goog.userAgent dependency.
2019-05-13 14:47:31 -07:00
translatewiki.net
6d962e5f87 Localisation updates from https://translatewiki.net. 2019-05-13 14:27:56 +02:00
Neil Fraser
28ad3a9bd3 Blockly.utils.userAgent moved to Blockly.userAgent 2019-05-10 16:56:26 -07:00
Neil Fraser
25ddecab50 Undo workaround for IE10.
Due to no longer supporting IE10, we don’t need the code added here: 92f3880008
2019-05-10 16:39:32 -07:00
Neil Fraser
fa8c7f3884 Lint fix. 2019-05-10 14:30:31 -07:00
Neil Fraser
4062030731 Remove goog.userAgent dependency. 2019-05-10 14:03:21 -07:00
translatewiki.net
e2281e5a98 Localisation updates from https://translatewiki.net. 2019-05-09 16:52:24 +02:00
asunwoo98
e25734ff25 typo fix in createVariable documentation in variable.js (#2443) 2019-05-06 13:09:50 -07:00
Rachel Fenichel
4af436f748 Merge pull request #2427 from BeksOmega/fixes/InitView
Refactored field.init into field.initView and field.initModel
2019-05-06 09:20:50 -07:00
translatewiki.net
f065c78dee Localisation updates from https://translatewiki.net. 2019-05-06 16:35:40 +02:00
Beka Westberg
354d402c49 Refactored field.init into field.initView and field.initModel 2019-05-03 07:12:46 -07:00
Rachel Fenichel
12a769b9c4 Merge pull request #2426 from rachel-fenichel/testing/run_mocha_tests
Add mocha tests to npm test
2019-05-02 15:32:09 -07:00
Rachel Fenichel
9e7becc262 Update comments 2019-05-02 15:31:54 -07:00
Navid Zandi
44501f17cc Resolve field angle overlap render problem (#2418)
* Rebuild and update version numbers

* rebuild

* Update version number to 1.20190419.0

* Resolve field angle overlap render problem

* use block.getColourBorder() function
2019-05-02 13:38:48 -07:00
Neil Fraser
834fa64674 Use Element constants and ‘i’ variable.
I don’t care about whether we use the Element constants or the ubiquitously known 1 & 3 integers.  But we had a mix.
Also, ’x’ is usually used for horizontal location, ‘i’ is an iterator.
No functional change.
2019-05-02 09:56:37 -07:00
Neil Fraser
6f433d7521 Don’t preserve IDs during cut/copy/paste or flyout
Previously, if the XML of a toolbox contained a block ID, the first creation of this block would inherit this ID.  Thus two realtime collaborators could realistically end up with conflict.  Likewise, cut and paste could generate similar conflict.
2019-05-02 09:56:37 -07:00
Neil Fraser
e06916e5e3 Factor out licence stripping
Matches code in Blockly Games.
No functional change.
2019-05-02 09:56:37 -07:00
Rachel Fenichel
5e56b4ad58 Merge pull request #2425 from BeksOmega/fixes/fromXml
Removed Explicitly Setting Variable Type to Two Single Quotes
2019-05-01 15:42:10 -07:00