kopia lustrzana https://github.com/backface/turtlestitch
added defaults to RESHAPE in palette
rodzic
b1660b9074
commit
b570798675
|
@ -18,6 +18,7 @@
|
|||
* threads: enhanced 'reshape' to also handle scalars
|
||||
* lists: limit crash-dangerous matrix-exploding ops to 1 MM elements (reshape, crossproduct)
|
||||
* objects, threads: took out "crossproduct" primitive option from the palette
|
||||
* objects, blocks: added defaults to RESHAPE in palette
|
||||
|
||||
### 2021-02-08
|
||||
* lists, objects, threads: new RESHAPE primitive
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<script src="src/morphic.js?version=2021-01-30"></script>
|
||||
<script src="src/symbols.js?version=2020-10-07"></script>
|
||||
<script src="src/widgets.js?version=2021-01-05"></script>
|
||||
<script src="src/blocks.js?version=2021-02-08"></script>
|
||||
<script src="src/blocks.js?version=2021-02-09"></script>
|
||||
<script src="src/threads.js?version=2021-02-09"></script>
|
||||
<script src="src/objects.js?version=2021-02-09"></script>
|
||||
<script src="src/gui.js?version=2021-02-04"></script>
|
||||
|
|
|
@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.blocks = '2021-February-08';
|
||||
modules.blocks = '2021-February-09';
|
||||
|
||||
var SyntaxElementMorph;
|
||||
var BlockMorph;
|
||||
|
@ -1241,11 +1241,15 @@ SyntaxElementMorph.prototype.revertToDefaultInput = function (arg, noValues) {
|
|||
// set default value
|
||||
if (!noValues) {
|
||||
if (inp !== -1) {
|
||||
if (deflt instanceof MultiArgMorph) {
|
||||
if (deflt instanceof MultiArgMorph && !inp) {
|
||||
// first - and only - input is variadic
|
||||
deflt.setContents(this.defaults);
|
||||
deflt.defaults = this.defaults;
|
||||
} else if (!isNil(this.defaults[inp])) {
|
||||
deflt.setContents(this.defaults[inp]);
|
||||
if (deflt instanceof MultiArgMorph) {
|
||||
deflt.defaults = this.defaults[inp];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1406,7 +1406,8 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
reportReshape: {
|
||||
type: 'reporter',
|
||||
category: 'lists',
|
||||
spec: 'reshape %l to %nums'
|
||||
spec: 'reshape %l to %nums',
|
||||
defaults: [null, [4, 3]]
|
||||
},
|
||||
|
||||
// HOFs
|
||||
|
@ -2229,6 +2230,9 @@ SpriteMorph.prototype.blockForSelector = function (selector, setDefaults) {
|
|||
for (i = 0; i < defaults.length; i += 1) {
|
||||
if (defaults[i] !== null) {
|
||||
inputs[i].setContents(defaults[i]);
|
||||
if (inputs[i] instanceof MultiArgMorph) {
|
||||
inputs[i].defaults = defaults[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue