kopia lustrzana https://github.com/backface/turtlestitch
experimental "rotate (list)" primitive relabelling option for "all but first"
rodzic
b5e210e657
commit
ef8dd4289b
|
@ -7,6 +7,7 @@
|
|||
* when constructing a costume from a pixel list handle single values as greyscale
|
||||
* experimental "column _ of _" reporter relabelling option for "item _ of _"
|
||||
* experimental "width of _" reporter relabelling option for "length of _"
|
||||
* experimental "rotate (list)" primitive relabelling option for "all but first"
|
||||
* renamed "Obsolete!" blocks to "Undefined!"
|
||||
* **Notable Fixes:**
|
||||
* fixed a glitch in the animation library's "sine in-out" easing function
|
||||
|
@ -17,6 +18,9 @@
|
|||
* German
|
||||
* Turkish
|
||||
|
||||
### 2021-01-29
|
||||
* threads, objects: new experimental "rotate (list)" primitive relabelling option for "all but first"
|
||||
|
||||
### 2021-01-27
|
||||
* threads: hyperized new experimental "column" primitive
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<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=2020-12-22"></script>
|
||||
<script src="src/threads.js?version=2021-01-27"></script>
|
||||
<script src="src/objects.js?version=2021-01-26"></script>
|
||||
<script src="src/threads.js?version=2021-01-29"></script>
|
||||
<script src="src/objects.js?version=2021-01-29"></script>
|
||||
<script src="src/gui.js?version=2021-01-21"></script>
|
||||
<script src="src/paint.js?version=2020-05-17"></script>
|
||||
<script src="src/lists.js?version=2020-12-01"></script>
|
||||
|
|
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
|
|||
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
||||
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
||||
|
||||
modules.objects = '2021-January-26';
|
||||
modules.objects = '2021-January-29';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
@ -1329,6 +1329,11 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
category: 'lists',
|
||||
spec: 'all but first of %l'
|
||||
},
|
||||
reportTableRotated: {
|
||||
type: 'reporter',
|
||||
category: 'lists',
|
||||
spec: 'rotate %l'
|
||||
},
|
||||
reportListLength: {
|
||||
type: 'reporter',
|
||||
category: 'lists',
|
||||
|
@ -1722,6 +1727,8 @@ SpriteMorph.prototype.blockAlternatives = {
|
|||
doHideVar: ['doShowVar'],
|
||||
|
||||
// lists
|
||||
reportCDR: ['reportTableRotated'],
|
||||
reportTableRotated: ['reportCDR'],
|
||||
reportListItem: ['reportTableColumn'],
|
||||
reportTableColumn: ['reportListItem'],
|
||||
reportListLength: ['reportTableWidth'],
|
||||
|
|
|
@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
|
|||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
|
||||
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
|
||||
|
||||
modules.threads = '2021-January-27';
|
||||
modules.threads = '2021-January-29';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -2048,6 +2048,23 @@ Process.prototype.reportTableColumn = function (index, list) {
|
|||
return list.map(row => row.at(index));
|
||||
};
|
||||
|
||||
Process.prototype.reportTableRotated = function (list) {
|
||||
// experimental and probably controversial as a primitive,
|
||||
// because it's so nice and easy to write in Snap!
|
||||
this.assertType(list, 'list');
|
||||
var width = Math.max(this.reportTableWidth(list), 1),
|
||||
col = (tab, c) => tab.map(row => row.at(c)),
|
||||
table = [],
|
||||
src, i;
|
||||
src = list.map(row =>
|
||||
row instanceof List ? row : new List(new Array(width).fill(row))
|
||||
);
|
||||
for (i = 1; i <= width; i += 1) {
|
||||
table.push(col(src, i));
|
||||
}
|
||||
return new List(table);
|
||||
};
|
||||
|
||||
// Process - other basic list accessors
|
||||
|
||||
Process.prototype.reportListLength = function (list) {
|
||||
|
|
Ładowanie…
Reference in New Issue