kopia lustrzana https://github.com/backface/turtlestitch
migrated logo pane rendering
rodzic
8e1f76a6b6
commit
b3835f3c90
18
src/gui.js
18
src/gui.js
|
@ -580,10 +580,9 @@ IDE_Morph.prototype.createLogo = function () {
|
||||||
|
|
||||||
this.logo = new Morph();
|
this.logo = new Morph();
|
||||||
this.logo.texture = this.logoURL;
|
this.logo.texture = this.logoURL;
|
||||||
this.logo.drawNew = function () {
|
|
||||||
this.image = newCanvas(this.extent(), false, this.image);
|
this.logo.render = function (ctx) {
|
||||||
var context = this.image.getContext('2d'),
|
gradient = ctx.createLinearGradient(
|
||||||
gradient = context.createLinearGradient(
|
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
this.width(),
|
this.width(),
|
||||||
|
@ -591,17 +590,16 @@ IDE_Morph.prototype.createLogo = function () {
|
||||||
);
|
);
|
||||||
gradient.addColorStop(0, 'black');
|
gradient.addColorStop(0, 'black');
|
||||||
gradient.addColorStop(0.5, myself.frameColor.toString());
|
gradient.addColorStop(0.5, myself.frameColor.toString());
|
||||||
context.fillStyle = MorphicPreferences.isFlat ?
|
ctx.fillStyle = MorphicPreferences.isFlat ?
|
||||||
myself.frameColor.toString() : gradient;
|
myself.frameColor.toString() : gradient;
|
||||||
context.fillRect(0, 0, this.width(), this.height());
|
ctx.fillRect(0, 0, this.width(), this.height());
|
||||||
if (this.texture) {
|
if (this.texture) {
|
||||||
this.drawTexture(this.texture);
|
this.renderTexture(this.texture, ctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.logo.drawCachedTexture = function () {
|
this.logo.renderCachedTexture = function (ctx) {
|
||||||
var context = this.image.getContext('2d');
|
ctx.drawImage(
|
||||||
context.drawImage(
|
|
||||||
this.cachedTexture,
|
this.cachedTexture,
|
||||||
5,
|
5,
|
||||||
Math.round((this.height() - this.cachedTexture.height) / 2)
|
Math.round((this.height() - this.cachedTexture.height) / 2)
|
||||||
|
|
Ładowanie…
Reference in New Issue