kopia lustrzana https://github.com/backface/turtlestitch
refactored IDE ways to create new sprites
rodzic
04e5444ced
commit
2b70a169e8
20
src/gui.js
20
src/gui.js
|
@ -2179,10 +2179,8 @@ IDE_Morph.prototype.selectSprite = function (sprite) {
|
||||||
if (
|
if (
|
||||||
detect(
|
detect(
|
||||||
this.world().children,
|
this.world().children,
|
||||||
function (morph) {
|
morph => morph instanceof BlockEditorMorph ||
|
||||||
return morph instanceof BlockEditorMorph ||
|
morph instanceof BlockDialogMorph
|
||||||
morph instanceof BlockDialogMorph;
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
|
@ -2401,8 +2399,7 @@ IDE_Morph.prototype.addNewSprite = function () {
|
||||||
|
|
||||||
IDE_Morph.prototype.paintNewSprite = function () {
|
IDE_Morph.prototype.paintNewSprite = function () {
|
||||||
var sprite = new SpriteMorph(this.globalVariables),
|
var sprite = new SpriteMorph(this.globalVariables),
|
||||||
cos = new Costume(),
|
cos = new Costume();
|
||||||
myself = this;
|
|
||||||
|
|
||||||
sprite.name = this.newSpriteName(sprite.name);
|
sprite.name = this.newSpriteName(sprite.name);
|
||||||
sprite.setCenter(this.stage.center());
|
sprite.setCenter(this.stage.center());
|
||||||
|
@ -2414,8 +2411,8 @@ IDE_Morph.prototype.paintNewSprite = function () {
|
||||||
this.world(),
|
this.world(),
|
||||||
this,
|
this,
|
||||||
true,
|
true,
|
||||||
function () {myself.removeSprite(sprite); },
|
() => this.removeSprite(sprite),
|
||||||
function () {
|
() => {
|
||||||
sprite.addCostume(cos);
|
sprite.addCostume(cos);
|
||||||
sprite.wearCostume(cos);
|
sprite.wearCostume(cos);
|
||||||
}
|
}
|
||||||
|
@ -2424,8 +2421,7 @@ IDE_Morph.prototype.paintNewSprite = function () {
|
||||||
|
|
||||||
IDE_Morph.prototype.newCamSprite = function () {
|
IDE_Morph.prototype.newCamSprite = function () {
|
||||||
var sprite = new SpriteMorph(this.globalVariables),
|
var sprite = new SpriteMorph(this.globalVariables),
|
||||||
camDialog,
|
camDialog;
|
||||||
myself = this;
|
|
||||||
|
|
||||||
sprite.name = this.newSpriteName(sprite.name);
|
sprite.name = this.newSpriteName(sprite.name);
|
||||||
sprite.setCenter(this.stage.center());
|
sprite.setCenter(this.stage.center());
|
||||||
|
@ -2437,8 +2433,8 @@ IDE_Morph.prototype.newCamSprite = function () {
|
||||||
camDialog = new CamSnapshotDialogMorph(
|
camDialog = new CamSnapshotDialogMorph(
|
||||||
this,
|
this,
|
||||||
sprite,
|
sprite,
|
||||||
function () { myself.removeSprite(sprite); },
|
() => this.removeSprite(sprite),
|
||||||
function (costume) {
|
function (costume) { // needs to be "function" to it can access "this"
|
||||||
sprite.addCostume(costume);
|
sprite.addCostume(costume);
|
||||||
sprite.wearCostume(costume);
|
sprite.wearCostume(costume);
|
||||||
this.close();
|
this.close();
|
||||||
|
|
Ładowanie…
Reference in New Issue