kopia lustrzana https://github.com/backface/turtlestitch
Optimize loading projects a bit more
rodzic
95a815b6d6
commit
0245a81fc0
63
blocks.js
63
blocks.js
|
@ -1421,16 +1421,19 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
|
||||||
new Point() : this.embossing;
|
new Point() : this.embossing;
|
||||||
part.drawNew();
|
part.drawNew();
|
||||||
} else {
|
} else {
|
||||||
part = new StringMorph(spec);
|
part = new StringMorph(
|
||||||
part.fontName = this.labelFontName;
|
spec, // text
|
||||||
part.fontStyle = this.labelFontStyle;
|
this.fontSize, // fontSize
|
||||||
part.fontSize = this.fontSize;
|
this.labelFontStyle, // fontStyle
|
||||||
part.color = new Color(255, 255, 255);
|
true, // bold
|
||||||
part.isBold = true;
|
false, // italic
|
||||||
part.shadowColor = this.color.darker(this.labelContrast);
|
false, // isNumeric
|
||||||
part.shadowOffset = MorphicPreferences.isFlat ?
|
MorphicPreferences.isFlat ?
|
||||||
new Point() : this.embossing;
|
new Point() : this.embossing, // shadowOffset
|
||||||
part.drawNew();
|
this.color.darker(this.labelContrast), // shadowColor
|
||||||
|
new Color(255, 255, 255), // color
|
||||||
|
this.labelFontName // fontName
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return part;
|
return part;
|
||||||
};
|
};
|
||||||
|
@ -6918,7 +6921,8 @@ InputSlotMorph.prototype.setChoices = function (dict, readonly) {
|
||||||
// InputSlotMorph layout:
|
// InputSlotMorph layout:
|
||||||
|
|
||||||
InputSlotMorph.prototype.fixLayout = function () {
|
InputSlotMorph.prototype.fixLayout = function () {
|
||||||
var contents = this.contents(),
|
var width, height, arrowWidth,
|
||||||
|
contents = this.contents(),
|
||||||
arrow = this.arrow();
|
arrow = this.arrow();
|
||||||
|
|
||||||
contents.isNumeric = this.isNumeric;
|
contents.isNumeric = this.isNumeric;
|
||||||
|
@ -6935,32 +6939,29 @@ InputSlotMorph.prototype.fixLayout = function () {
|
||||||
arrow.setSize(this.fontSize);
|
arrow.setSize(this.fontSize);
|
||||||
arrow.show();
|
arrow.show();
|
||||||
} else {
|
} else {
|
||||||
arrow.setSize(0);
|
|
||||||
arrow.hide();
|
arrow.hide();
|
||||||
}
|
}
|
||||||
this.setHeight(
|
arrowWidth = arrow.isVisible ? arrow.width() : 0;
|
||||||
contents.height()
|
|
||||||
+ this.edge * 2
|
height = contents.height() + this.edge * 2; // + this.typeInPadding * 2
|
||||||
// + this.typeInPadding * 2
|
|
||||||
);
|
|
||||||
if (this.isNumeric) {
|
if (this.isNumeric) {
|
||||||
this.setWidth(contents.width()
|
width = contents.width()
|
||||||
+ Math.floor(arrow.width() * 0.5)
|
+ Math.floor(arrowWidth * 0.5)
|
||||||
+ this.height()
|
+ this.height()
|
||||||
+ this.typeInPadding * 2
|
+ this.typeInPadding * 2;
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
this.setWidth(Math.max(
|
width = Math.max(
|
||||||
contents.width()
|
contents.width()
|
||||||
+ arrow.width()
|
+ arrowWidth
|
||||||
+ this.edge * 2
|
+ this.edge * 2
|
||||||
+ this.typeInPadding * 2,
|
+ this.typeInPadding * 2,
|
||||||
contents.rawHeight ? // single vs. multi-line contents
|
contents.rawHeight ? // single vs. multi-line contents
|
||||||
contents.rawHeight() + arrow.width()
|
contents.rawHeight() + arrowWidth
|
||||||
: contents.height() / 1.2 + arrow.width(),
|
: contents.height() / 1.2 + arrowWidth,
|
||||||
this.minWidth // for text-type slots
|
this.minWidth // for text-type slots
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
this.setExtent(new Point(width, height));
|
||||||
if (this.isNumeric) {
|
if (this.isNumeric) {
|
||||||
contents.setPosition(new Point(
|
contents.setPosition(new Point(
|
||||||
Math.floor(this.height() / 2),
|
Math.floor(this.height() / 2),
|
||||||
|
@ -6973,10 +6974,12 @@ InputSlotMorph.prototype.fixLayout = function () {
|
||||||
).add(new Point(this.typeInPadding, 0)).add(this.position()));
|
).add(new Point(this.typeInPadding, 0)).add(this.position()));
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow.setPosition(new Point(
|
if (arrow.isVisible) {
|
||||||
this.right() - arrow.width() - this.edge,
|
arrow.setPosition(new Point(
|
||||||
contents.top()
|
this.right() - arrowWidth - this.edge,
|
||||||
));
|
contents.top()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if (this.parent) {
|
if (this.parent) {
|
||||||
if (this.parent.fixLayout) {
|
if (this.parent.fixLayout) {
|
||||||
|
|
|
@ -2199,7 +2199,7 @@ function Morph() {
|
||||||
|
|
||||||
// Morph initialization:
|
// Morph initialization:
|
||||||
|
|
||||||
Morph.prototype.init = function () {
|
Morph.prototype.init = function (noDraw) {
|
||||||
Morph.uber.init.call(this);
|
Morph.uber.init.call(this);
|
||||||
this.isMorph = true;
|
this.isMorph = true;
|
||||||
this.bounds = new Rectangle(0, 0, 50, 40);
|
this.bounds = new Rectangle(0, 0, 50, 40);
|
||||||
|
@ -2212,7 +2212,7 @@ Morph.prototype.init = function () {
|
||||||
this.isTemplate = false;
|
this.isTemplate = false;
|
||||||
this.acceptsDrops = false;
|
this.acceptsDrops = false;
|
||||||
this.noticesTransparentClick = false;
|
this.noticesTransparentClick = false;
|
||||||
this.drawNew();
|
if (!noDraw) this.drawNew();
|
||||||
this.fps = 0;
|
this.fps = 0;
|
||||||
this.customContextMenu = null;
|
this.customContextMenu = null;
|
||||||
this.lastTime = Date.now();
|
this.lastTime = Date.now();
|
||||||
|
@ -6999,7 +6999,7 @@ StringMorph.prototype.init = function (
|
||||||
this.markedBackgoundColor = new Color(60, 60, 120);
|
this.markedBackgoundColor = new Color(60, 60, 120);
|
||||||
|
|
||||||
// initialize inherited properties:
|
// initialize inherited properties:
|
||||||
StringMorph.uber.init.call(this);
|
StringMorph.uber.init.call(this, true);
|
||||||
|
|
||||||
// override inherited properites:
|
// override inherited properites:
|
||||||
this.color = color || new Color(0, 0, 0);
|
this.color = color || new Color(0, 0, 0);
|
||||||
|
|
Ładowanie…
Reference in New Issue