hyperized "distance/direction to _" reporter primitive

pull/95/head
jmoenig 2020-09-02 18:17:23 +02:00
rodzic 51a8b9e05b
commit 4512ade487
3 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -4,11 +4,15 @@
* **New Features:**
* show message senders and receivers from the blocks context menu, thanks, Bernat!
* new "Database" library operating on localstore, thanks, Jadga!
* hyperized "distance/direction to _" reporter primitive
* **Translation Updates:**
* Catalan, thanks, Joan!
* Norwegian, thanks, Olav!
* German
### 2020-09-02
* threads: hyperized "distance/direction to _" reporter primitive
### 2020-09-01
* Norwegian translation update, thanks, Olav
* gui, blocks: fixed a bunch of typos and UI strings, thanks, Brian Broll!

Wyświetl plik

@ -9,7 +9,7 @@
<script src="src/symbols.js?version=2020-07-21"></script>
<script src="src/widgets.js?version=2020-07-27"></script>
<script src="src/blocks.js?version=2020-09-01"></script>
<script src="src/threads.js?version=2020-08-05"></script>
<script src="src/threads.js?version=2020-09-02"></script>
<script src="src/objects.js?version=2020-09-01"></script>
<script src="src/gui.js?version=2020-09-01"></script>
<script src="src/paint.js?version=2020-05-17"></script>

Wyświetl plik

@ -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 = '2020-August-05';
modules.threads = '2020-September-02';
var ThreadManager;
var Process;
@ -4684,6 +4684,12 @@ Process.prototype.spritesAtPoint = function (point, stage) {
};
Process.prototype.reportRelationTo = function (relation, name) {
if (this.enableHyperOps) {
if (name instanceof List && !this.isCoordinate(name)) {
return name.map(each => this.reportRelationTo(relation, each));
}
}
var rel = this.inputOption(relation);
if (rel === 'distance') {
return this.reportDistanceTo(name);
@ -4694,6 +4700,13 @@ Process.prototype.reportRelationTo = function (relation, name) {
return 0;
};
Process.prototype.isCoordinate = function (data) {
return data instanceof List &&
(data.length() === 2) &&
this.reportTypeOf(data.at(1)) === 'number' &&
this.reportTypeOf(data.at(2)) === 'number';
};
Process.prototype.reportDistanceTo = function (name) {
var thisObj = this.blockReceiver(),
thatObj,