migrated sprite icon button rendering

pull/95/head
jmoenig 2020-03-05 09:11:53 +01:00
rodzic d5f4a05c54
commit 2ba72b1c9d
1 zmienionych plików z 19 dodań i 33 usunięć

Wyświetl plik

@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.gui = '2020-March-03'; modules.gui = '2020-March-05';
// Declarations // Declarations
@ -8276,39 +8276,25 @@ SpriteIconMorph.prototype.mouseDoubleClick = function () {
// SpriteIconMorph drawing // SpriteIconMorph drawing
SpriteIconMorph.prototype.createBackgrounds = function () { SpriteIconMorph.prototype.render = function (ctx) {
// only draw the edges if I am selected // only draw the edges if I am selected
var context, switch (this.userState) {
ext = this.extent(); case 'highlight':
this.drawBackground(ctx, this.highlightColor);
if (this.template) { // take the backgrounds images from the template break;
this.image = this.template.image; case 'pressed':
this.normalImage = this.template.normalImage; this.drawOutline(ctx);
this.highlightImage = this.template.highlightImage; this.drawBackground(ctx, this.pressColor);
this.pressImage = this.template.pressImage; this.drawEdges(
return null; ctx,
this.pressColor,
this.pressColor.lighter(40),
this.pressColor.darker(40)
);
break;
default:
this.drawBackground(ctx, this.color);
} }
this.normalImage = newCanvas(ext, false, this.normalImage);
context = this.normalImage.getContext('2d');
this.drawBackground(context, this.color);
this.highlightImage = newCanvas(ext, false, this.highlightImage);
context = this.highlightImage.getContext('2d');
this.drawBackground(context, this.highlightColor);
this.pressImage = newCanvas(ext, false, this.pressImage);
context = this.pressImage.getContext('2d');
this.drawOutline(context);
this.drawBackground(context, this.pressColor);
this.drawEdges(
context,
this.pressColor,
this.pressColor.lighter(this.contrast),
this.pressColor.darker(this.contrast)
);
this.image = this.normalImage;
}; };
// SpriteIconMorph drag & drop // SpriteIconMorph drag & drop