WIP show block calling a reportGetVar

snap7
Michael Ball 2021-07-06 11:53:28 -07:00
rodzic 9ee9e02840
commit 7e537fc7ae
2 zmienionych plików z 12 dodań i 16 usunięć

Wyświetl plik

@ -4196,13 +4196,18 @@ BlockMorph.prototype.errorPic = function () {
// return a picture of myself, that approximately fits in "one line"
// filter any blocks beneath me, so that users only see the first
// block that caused an error.
if (this.nextBlock) {
var copy = this.fullCopy();
var block = this;
if (block.selector === 'reportGetVar') {
// if I am a single variable, show my caller in the output.
block = block.parent;
}
if (block.nextBlock) {
var copy = block.fullCopy();
copy.removeChild(copy.nextBlock());
return copy.fullImage();
}
return this.fullImage();
return block.fullImage();
}
BlockMorph.prototype.fullImage = function () {

Wyświetl plik

@ -1176,9 +1176,9 @@ Process.prototype.errorBubble = function (error, element) {
// above the text of error.
var errorMorph = new AlignmentMorph('column', 5),
errorIsNested = isNil(element.world()),
errorPrefix = errorIsNested ? localize('Inside a custom block') + ':\n' : '',
errorPrefix = errorIsNested ? `${localize('Inside a custom block')}:\n`: '',
errorMessage = new TextMorph(
errorPrefix + localize(error.name) + ':\n' + error.message,
`${errorPrefix}${localize(error.name)}:\n${localize(error.message)}`,
SyntaxElementMorph.prototype.fontSize
),
img, blockImage;
@ -1186,22 +1186,13 @@ Process.prototype.errorBubble = function (error, element) {
errorMorph.add(errorMessage);
errorMorph.alpha = 0;
if (errorIsNested) {
window.element = element;
errorMorph.text += `\n${localize('The error occured at:')}\n`;
img = element.errorPic();
blockImage = new Morph();
blockImage.isCachingImage = true;
blockImage.bounds.setWidth(img.width);
blockImage.bounds.setHeight(img.height);
// blockImage.setExtent(new Point(img.width, img.height));
blockImage.setExtent(new Point(img.width, img.height));
blockImage.cachedImage = img;
// blockImage.image = img;
// errorMessage.setTop(blockImage.height() + 2);
errorMorph.add(blockImage);
// errorMorph.setExtent(new Point(
// Math.max(blockImage.width(), errorMessage.width()),
// blockImage.height() + errorMessage.height()
// ));
errorMorph.fixLayout();
}