Screenshot names are now correctly tracked

pull/3/merge
Viraj Mahesh 2014-03-07 15:02:30 -08:00
rodzic 6c357a5ed1
commit 8a74747cd7
1 zmienionych plików z 13 dodań i 11 usunięć

Wyświetl plik

@ -1243,8 +1243,7 @@ SpriteMorph.prototype.init = function (globals) {
this.drawNew(); this.drawNew();
this.changed(); this.changed();
//Screenshot counter this.screenshotNames = {}; // Keeps track of stage image names
this.screenshotCount = 0;
}; };
// SpriteMorph duplicating (fullCopy) // SpriteMorph duplicating (fullCopy)
@ -3706,16 +3705,19 @@ SpriteMorph.prototype.reactToDropOf = function (morph, hand) {
morph.slideBackTo(hand.grabOrigin); morph.slideBackTo(hand.grabOrigin);
}; };
SpriteMorph.prototype.doScreenshot = function(data) { SpriteMorph.prototype.doScreenshot = function (data) {
var stage = this.parentThatIsA(StageMorph); if (this.screenshotNames.hasOwnProperty(data)) {
var canvas = stage.fullImageClassic(); this.screenshotNames[data] += 1;
var ide = this.parentThatIsA(IDE_Morph); data += '(' + this.screenshotNames[data] + ')';
var screenshotName = data; } else {
if(this.screenshotCount != 0) this.screenshotNames[data] = 0;
screenshotName += ' ' + this.screenshotCount; }
var costume = new Costume(canvas, screenshotName); var stage = this.parentThatIsA(StageMorph),
canvas = stage.fullImageClassic(),
ide = this.parentThatIsA(IDE_Morph),
screenshotName = data,
costume = new Costume(canvas, screenshotName);
ide.currentSprite.addCostume(costume); ide.currentSprite.addCostume(costume);
this.screenshotCount++;
}; };
// SpriteHighlightMorph ///////////////////////////////////////////////// // SpriteHighlightMorph /////////////////////////////////////////////////