kopia lustrzana https://github.com/backface/turtlestitch
refactored blocks coloring
rodzic
b22c94e321
commit
000bf48699
|
@ -3869,13 +3869,13 @@ BlockMorph.prototype.scriptPic = function () {
|
||||||
fb = this.stackFullBounds(),
|
fb = this.stackFullBounds(),
|
||||||
pic = newCanvas(fb.extent()),
|
pic = newCanvas(fb.extent()),
|
||||||
ctx = pic.getContext('2d');
|
ctx = pic.getContext('2d');
|
||||||
this.allComments().forEach(function (comment) {
|
this.allComments().forEach(comment =>
|
||||||
ctx.drawImage(
|
ctx.drawImage(
|
||||||
comment.fullImage(),
|
comment.fullImage(),
|
||||||
comment.fullBounds().left() - fb.left(),
|
comment.fullBounds().left() - fb.left(),
|
||||||
comment.top() - fb.top()
|
comment.top() - fb.top()
|
||||||
);
|
)
|
||||||
});
|
);
|
||||||
ctx.drawImage(scr, 0, 0);
|
ctx.drawImage(scr, 0, 0);
|
||||||
return pic;
|
return pic;
|
||||||
};
|
};
|
||||||
|
@ -4087,10 +4087,8 @@ BlockMorph.prototype.highlightImageBlurred = function (color, blur) {
|
||||||
|
|
||||||
BlockMorph.prototype.getHighlight = function () {
|
BlockMorph.prototype.getHighlight = function () {
|
||||||
var highlights;
|
var highlights;
|
||||||
highlights = this.children.slice(0).reverse().filter(
|
highlights = this.children.slice(0).reverse().filter(child =>
|
||||||
function (child) {
|
child instanceof BlockHighlightMorph
|
||||||
return child instanceof BlockHighlightMorph;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
if (highlights.length !== 0) {
|
if (highlights.length !== 0) {
|
||||||
return highlights[0];
|
return highlights[0];
|
||||||
|
@ -4210,12 +4208,11 @@ BlockMorph.prototype.fixLabelColor = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
BlockMorph.prototype.fixChildrensBlockColor = function (isForced) {
|
BlockMorph.prototype.fixChildrensBlockColor = function (isForced) {
|
||||||
var myself = this;
|
this.children.forEach(morph => {
|
||||||
this.children.forEach(function (morph) {
|
|
||||||
if (morph instanceof CommandBlockMorph) {
|
if (morph instanceof CommandBlockMorph) {
|
||||||
morph.fixBlockColor(null, isForced);
|
morph.fixBlockColor(null, isForced);
|
||||||
} else if (morph instanceof SyntaxElementMorph) {
|
} else if (morph instanceof SyntaxElementMorph) {
|
||||||
morph.fixBlockColor(myself, isForced);
|
morph.fixBlockColor(this, isForced);
|
||||||
if (morph instanceof BooleanSlotMorph) {
|
if (morph instanceof BooleanSlotMorph) {
|
||||||
morph.fixLayout();
|
morph.fixLayout();
|
||||||
}
|
}
|
||||||
|
@ -4229,9 +4226,7 @@ BlockMorph.prototype.setCategory = function (aString) {
|
||||||
};
|
};
|
||||||
|
|
||||||
BlockMorph.prototype.hasLabels = function () {
|
BlockMorph.prototype.hasLabels = function () {
|
||||||
return this.children.some(function (any) {
|
return this.children.some(any => any instanceof StringMorph);
|
||||||
return any instanceof StringMorph;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// BlockMorph copying
|
// BlockMorph copying
|
||||||
|
|
Ładowanie…
Reference in New Issue