refactored Context >> image

snap7
Jens Mönig 2022-01-21 10:01:23 +01:00
rodzic dfa57d4de7
commit 43318dd5c2
3 zmienionych plików z 15 dodań i 12 usunięć

Wyświetl plik

@ -12,6 +12,9 @@
* **Translation Updates:**
* German (for error messages)
### 2022-01-21
* threads: refactored Context >> image
### 2022-01-20
* German translation update (for error messages)
* threads: added more localizable error strings

Wyświetl plik

@ -17,7 +17,7 @@
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-17-09"></script>
<script src="src/blocks.js?version=2022-01-07"></script>
<script src="src/threads.js?version=2022-01-20"></script>
<script src="src/threads.js?version=2022-01-21"></script>
<script src="src/objects.js?version=2022-01-20"></script>
<script src="src/scenes.js?version=2021-11-24"></script>
<script src="src/gui.js?version=2022-01-17"></script>

Wyświetl plik

@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/
/*jshint esversion: 6*/
modules.threads = '2022-January-20';
modules.threads = '2022-January-21';
var ThreadManager;
var Process;
@ -7003,6 +7003,11 @@ Context.prototype.toString = function () {
};
Context.prototype.image = function () {
var ring = this.toBlock();
return ring.doWithAlpha(1, () => ring.fullImage());
};
Context.prototype.toBlock = function () {
var ring = new RingMorph(),
block,
cont;
@ -7021,21 +7026,16 @@ Context.prototype.image = function () {
}
}
ring.embed(block, this.inputs);
return ring.doWithAlpha(
1,
() => {
ring.clearAlpha();
return ring.fullImage();
}
);
ring.clearAlpha();
return ring;
}
if (this.expression instanceof Array) {
block = this.expression[this.pc].fullCopy();
if (block instanceof RingMorph && !block.contents()) { // empty ring
return block.doWithAlpha(1, () => block.fullImage());
return block;
}
ring.embed(block, this.isContinuation ? [] : this.inputs);
return ring.doWithAlpha(1, () => ring.fullImage());
return ring;
}
// otherwise show an empty ring
@ -7048,7 +7048,7 @@ Context.prototype.image = function () {
ring.parts()[1].addInput(inp)
);
}
return ring.doWithAlpha(1, () => ring.fullImage());
return ring;
};
// Context continuations: