kopia lustrzana https://github.com/backface/turtlestitch
simplified warping
rodzic
aeb499c677
commit
43a7fc2002
|
@ -1982,20 +1982,6 @@ SpriteMorph.prototype.render = function (ctx) {
|
||||||
this.version = Date.now();
|
this.version = Date.now();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* // +++ should be removed
|
|
||||||
SpriteMorph.prototype.endWarp = function () { // +++ is this needed anymore?
|
|
||||||
this.isWarped = false;
|
|
||||||
if (this.wantsRedraw) {
|
|
||||||
var x = this.xPosition(),
|
|
||||||
y = this.yPosition();
|
|
||||||
this.drawNew();
|
|
||||||
this.silentGotoXY(x, y, true); // just me
|
|
||||||
this.wantsRedraw = false;
|
|
||||||
}
|
|
||||||
this.parent.changed();
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
SpriteMorph.prototype.rotationCenter = function () {
|
SpriteMorph.prototype.rotationCenter = function () {
|
||||||
return this.position().add(this.rotationOffset);
|
return this.position().add(this.rotationOffset);
|
||||||
};
|
};
|
||||||
|
@ -3483,19 +3469,12 @@ SpriteMorph.prototype.addCostume = function (costume) {
|
||||||
SpriteMorph.prototype.wearCostume = function (costume, noShadow) {
|
SpriteMorph.prototype.wearCostume = function (costume, noShadow) {
|
||||||
var x = this.xPosition ? this.xPosition() : null,
|
var x = this.xPosition ? this.xPosition() : null,
|
||||||
y = this.yPosition ? this.yPosition() : null,
|
y = this.yPosition ? this.yPosition() : null,
|
||||||
idx = isNil(costume) ? null : this.costumes.asArray().indexOf(costume),
|
idx = isNil(costume) ? null : this.costumes.asArray().indexOf(costume);
|
||||||
isWarped = this.isWarped;
|
|
||||||
|
|
||||||
if (isWarped) {
|
|
||||||
this.endWarp();
|
|
||||||
}
|
|
||||||
this.changed();
|
this.changed();
|
||||||
this.costume = costume;
|
this.costume = costume;
|
||||||
this.fixLayout();
|
this.fixLayout();
|
||||||
this.rerender();
|
this.rerender();
|
||||||
if (isWarped) {
|
|
||||||
this.startWarp();
|
|
||||||
}
|
|
||||||
if (x !== null) {
|
if (x !== null) {
|
||||||
this.silentGotoXY(x, y, true); // just me
|
this.silentGotoXY(x, y, true); // just me
|
||||||
}
|
}
|
||||||
|
@ -4289,10 +4268,6 @@ SpriteMorph.prototype.reportTouchingColor = function (aColor) {
|
||||||
data, len, i;
|
data, len, i;
|
||||||
|
|
||||||
if (stage) {
|
if (stage) {
|
||||||
if (this.wantsRedraw && this.isWarped) {
|
|
||||||
this.endWarp();
|
|
||||||
this.startWarp();
|
|
||||||
}
|
|
||||||
data = this.overlappingPixels(stage);
|
data = this.overlappingPixels(stage);
|
||||||
if (!data) {return false; }
|
if (!data) {return false; }
|
||||||
len = data[0].length;
|
len = data[0].length;
|
||||||
|
@ -4319,10 +4294,6 @@ SpriteMorph.prototype.reportColorIsTouchingColor = function (
|
||||||
data, len, i;
|
data, len, i;
|
||||||
|
|
||||||
if (stage) {
|
if (stage) {
|
||||||
if (this.wantsRedraw && this.isWarped) {
|
|
||||||
this.endWarp();
|
|
||||||
this.startWarp();
|
|
||||||
}
|
|
||||||
data = this.overlappingPixels(stage);
|
data = this.overlappingPixels(stage);
|
||||||
if (!data) {return false; }
|
if (!data) {return false; }
|
||||||
len = data[0].length;
|
len = data[0].length;
|
||||||
|
@ -4620,13 +4591,9 @@ SpriteMorph.prototype.setScale = function (percentage, noShadow) {
|
||||||
// set my (absolute) scale in percent
|
// set my (absolute) scale in percent
|
||||||
var x = this.xPosition(),
|
var x = this.xPosition(),
|
||||||
y = this.yPosition(),
|
y = this.yPosition(),
|
||||||
isWarped = this.isWarped, // +++ should be obsolete, remove
|
|
||||||
realScale,
|
realScale,
|
||||||
growth;
|
growth;
|
||||||
|
|
||||||
if (isWarped) { // +++ should be obsolete, remove
|
|
||||||
this.endWarp();
|
|
||||||
}
|
|
||||||
realScale = (+percentage || 0) / 100;
|
realScale = (+percentage || 0) / 100;
|
||||||
growth = realScale / this.nestingScale;
|
growth = realScale / this.nestingScale;
|
||||||
this.nestingScale = realScale;
|
this.nestingScale = realScale;
|
||||||
|
@ -4636,12 +4603,7 @@ SpriteMorph.prototype.setScale = function (percentage, noShadow) {
|
||||||
this.changed();
|
this.changed();
|
||||||
this.fixLayout();
|
this.fixLayout();
|
||||||
this.rerender();
|
this.rerender();
|
||||||
// +++ this.drawNew();
|
|
||||||
// +++ this.changed();
|
|
||||||
|
|
||||||
if (isWarped) { // should be obsolete, remove
|
|
||||||
this.startWarp();
|
|
||||||
}
|
|
||||||
this.silentGotoXY(x, y, true); // just me
|
this.silentGotoXY(x, y, true); // just me
|
||||||
this.positionTalkBubble();
|
this.positionTalkBubble();
|
||||||
|
|
||||||
|
@ -7952,24 +7914,9 @@ StageMorph.prototype.step = function () {
|
||||||
this.stepGenericConditions();
|
this.stepGenericConditions();
|
||||||
}
|
}
|
||||||
if (this.isFastTracked && this.threads.processes.length) {
|
if (this.isFastTracked && this.threads.processes.length) {
|
||||||
this.children.forEach(function (morph) {
|
while ((Date.now() - this.lastTime) < 15) { // approx. 67 fps
|
||||||
if (morph instanceof SpriteMorph) {
|
|
||||||
morph.wasWarped = morph.isWarped;
|
|
||||||
if (!morph.isWarped) {
|
|
||||||
morph.startWarp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
while ((Date.now() - this.lastTime) < 17) { // approx. 60 fps
|
|
||||||
this.threads.step();
|
this.threads.step();
|
||||||
}
|
}
|
||||||
this.children.forEach(function (morph) {
|
|
||||||
if (morph instanceof SpriteMorph) {
|
|
||||||
if (!morph.wasWarped) {
|
|
||||||
morph.endWarp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.changed();
|
this.changed();
|
||||||
} else {
|
} else {
|
||||||
this.threads.step();
|
this.threads.step();
|
||||||
|
|
Ładowanie…
Reference in New Issue