migrated sprite icon thumbnails

pull/95/head
jmoenig 2020-03-05 12:30:21 +01:00
rodzic 2ba72b1c9d
commit 0538361ace
3 zmienionych plików z 13 dodań i 10 usunięć

Wyświetl plik

@ -1303,7 +1303,7 @@ IDE_Morph.prototype.createSpriteBar = function () {
thumbnail = new Morph();
thumbnail.isCachingImage = true; // +++ review and refactor this to reuse the canvas
thumbnail.setExtent(thumbSize);
thumbnail.bounds.setExtent(thumbSize);
thumbnail.cachedImage = this.currentSprite.thumbnail(thumbSize);
thumbnail.setPosition(
rotationStyleButtons[0].topRight().add(new Point(5, 3))
@ -2108,7 +2108,6 @@ IDE_Morph.prototype.stopFastTracking = function () {
this.stage.isFastTracked = false;
this.stage.fps = this.stage.frameRate;
this.controlBar.startButton.labelString = new SymbolMorph('flag', 14);
this.controlBar.startButton.drawNew();
this.controlBar.startButton.fixLayout();
};
@ -8028,7 +8027,7 @@ SpriteIconMorph.prototype.createThumbnail = function () {
this.thumbnail = new Morph();
this.thumbnail.isCachingImage = true; // +++ review thumbnails
this.thumbnail.setExtent(this.thumbSize);
this.thumbnail.bounds.setExtent(this.thumbSize);
if (this.object instanceof SpriteMorph) { // support nested sprites
this.thumbnail.cachedImage = this.object.fullThumbnail(this.thumbSize); // +++ recycle canvas
this.createRotationButton();

Wyświetl plik

@ -1928,7 +1928,6 @@ SpriteMorph.prototype.fixLayout = function () {
this.setCenter(currentCenter, true); // just me
this.rotationOffset = this.extent().divideBy(2);
}
this.version = Date.now();
};
SpriteMorph.prototype.render = function (ctx) {
@ -1992,6 +1991,7 @@ SpriteMorph.prototype.render = function (ctx) {
}
// apply graphics effects to image
// +++ this.cachedImage = this.applyGraphicsEffects(this.cachedImage); // +++ graphic effects disabled while working on rendering
this.version = Date.now();
};
SpriteMorph.prototype.endWarp = function () { // +++ is this needed anymore?

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2019-December-09';
modules.store = '2020-March-05';
// XML_Serializer ///////////////////////////////////////////////////////
@ -1289,7 +1289,8 @@ SnapSerializer.prototype.loadInput = function (model, input, block, object) {
inp = this.loadScript(model, object);
if (inp) {
if (block.selector === 'reifyReporter') {
input.silentReplaceInput(input.children[0], inp);
//+++ input.silentReplaceInput(input.children[0], inp);
input.replaceInput(input.children[0], inp);
input.fixLayout();
} else {
input.add(inp);
@ -1299,7 +1300,8 @@ SnapSerializer.prototype.loadInput = function (model, input, block, object) {
} else if (model.tag === 'autolambda' && model.children[0]) {
inp = this.loadBlock(model.children[0], true, object);
if (inp) {
input.silentReplaceInput(input.children[0], inp);
// input.silentReplaceInput(input.children[0], inp);
input.replaceInput(input.children[0], inp);
input.fixLayout();
}
} else if (model.tag === 'list') {
@ -1317,7 +1319,8 @@ SnapSerializer.prototype.loadInput = function (model, input, block, object) {
});
input.fixLayout();
} else if (model.tag === 'block' || model.tag === 'custom-block') {
block.silentReplaceInput(input, this.loadBlock(model, true, object));
// block.silentReplaceInput(input, this.loadBlock(model, true, object));
block.replaceInput(input, this.loadBlock(model, true, object));
} else if (model.tag === 'color') {
input.setColor(this.loadColor(model.contents));
} else {
@ -1462,7 +1465,7 @@ SnapSerializer.prototype.loadValue = function (model, object) {
v.isDraggable = model.attributes.draggable !== 'false';
v.isVisible = model.attributes.hidden !== 'true';
v.heading = parseFloat(model.attributes.heading) || 0;
v.drawNew();
// +++ v.drawNew();
v.gotoXY(+model.attributes.x || 0, +model.attributes.y || 0);
myself.loadObject(v, model);
return v;
@ -1667,7 +1670,8 @@ SnapSerializer.prototype.openProject = function (project, ide) {
} else {
ide.hasChangedMedia = true;
}
project.stage.drawNew();
// +++ project.stage.drawNew();
project.stage.fixLayout();
ide.createCorral();
ide.selectSprite(sprite);
ide.fixLayout();