kopia lustrzana https://github.com/backface/turtlestitch
added "current" to costume input slot dropdown
rodzic
13a32a9e64
commit
7dba7a0576
|
@ -67,7 +67,8 @@
|
||||||
* Blocks, Objects, Threads: new "getImageAttribute" reporter primitive
|
* Blocks, Objects, Threads: new "getImageAttribute" reporter primitive
|
||||||
* Objects, Threads: let "getImageAttribute" deal with null costumes
|
* Objects, Threads: let "getImageAttribute" deal with null costumes
|
||||||
* Objects, Threads: new "stretch" primitive for costumes, also for flipping
|
* Objects, Threads: new "stretch" primitive for costumes, also for flipping
|
||||||
* Threas: new feature: new costume from list of pixels
|
* Threads: new feature: new costume from list of pixels
|
||||||
|
* Objects, Threads: added "current" to costume input slot dropdown
|
||||||
|
|
||||||
### 2019-04-08
|
### 2019-04-08
|
||||||
* Blocks, Objects, Threads: new "getSoundAttribute" reporter primitive
|
* Blocks, Objects, Threads: new "getSoundAttribute" reporter primitive
|
||||||
|
|
|
@ -8918,6 +8918,7 @@ InputSlotMorph.prototype.costumesMenu = function () {
|
||||||
} else { // stage
|
} else { // stage
|
||||||
dict = {Empty : ['Empty']};
|
dict = {Empty : ['Empty']};
|
||||||
}
|
}
|
||||||
|
dict.current = ['current'];
|
||||||
rcvr.costumes.asArray().forEach(function (costume) {
|
rcvr.costumes.asArray().forEach(function (costume) {
|
||||||
allNames = allNames.concat(costume.name);
|
allNames = allNames.concat(costume.name);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3294,6 +3294,9 @@ SpriteMorph.prototype.doSwitchToCostume = function (id, noShadow) {
|
||||||
this.wearCostume(id, noShadow);
|
this.wearCostume(id, noShadow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (id instanceof Array && (id[0] === 'current')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var num,
|
var num,
|
||||||
arr = this.costumes.asArray(),
|
arr = this.costumes.asArray(),
|
||||||
|
|
|
@ -4338,14 +4338,7 @@ Process.prototype.doSetInstrument = function (num) {
|
||||||
// Process image processing primitives
|
// Process image processing primitives
|
||||||
|
|
||||||
Process.prototype.reportGetImageAttribute = function (choice, name) {
|
Process.prototype.reportGetImageAttribute = function (choice, name) {
|
||||||
var cst = name instanceof Costume ? name
|
var cst = this.costumeNamed(name) || new Costume(),
|
||||||
: (typeof name === 'number' ?
|
|
||||||
this.blockReceiver().costumes.at(name)
|
|
||||||
: detect(
|
|
||||||
this.blockReceiver().costumes.asArray(),
|
|
||||||
function (c) {return c.name === name.toString(); }
|
|
||||||
)
|
|
||||||
) || new Costume(),
|
|
||||||
option = this.inputOption(choice);
|
option = this.inputOption(choice);
|
||||||
|
|
||||||
switch (option) {
|
switch (option) {
|
||||||
|
@ -4363,18 +4356,11 @@ Process.prototype.reportGetImageAttribute = function (choice, name) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.reportNewCostumeStretched = function (name, xP, yP) {
|
Process.prototype.reportNewCostumeStretched = function (name, xP, yP) {
|
||||||
|
var cst;
|
||||||
if (name instanceof List) {
|
if (name instanceof List) {
|
||||||
return this.reportNewCostume(name, xP, yP);
|
return this.reportNewCostume(name, xP, yP);
|
||||||
}
|
}
|
||||||
|
cst = this.costumeNamed(name);
|
||||||
var cst = name instanceof Costume ? name
|
|
||||||
: (typeof name === 'number' ?
|
|
||||||
this.blockReceiver().costumes.at(name)
|
|
||||||
: detect(
|
|
||||||
this.blockReceiver().costumes.asArray(),
|
|
||||||
function (c) {return c.name === name.toString(); }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (!cst) {
|
if (!cst) {
|
||||||
return new Costume();
|
return new Costume();
|
||||||
}
|
}
|
||||||
|
@ -4384,6 +4370,23 @@ Process.prototype.reportNewCostumeStretched = function (name, xP, yP) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Process.prototype.costumeNamed = function (name) {
|
||||||
|
// private
|
||||||
|
if (name instanceof Costume) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
if (typeof name === 'number') {
|
||||||
|
return this.blockReceiver().costumes.at(name);
|
||||||
|
}
|
||||||
|
if (this.inputOption(name) === 'current') {
|
||||||
|
return this.blockReceiver().costume;
|
||||||
|
}
|
||||||
|
return detect(
|
||||||
|
this.blockReceiver().costumes.asArray(),
|
||||||
|
function (c) {return c.name === name.toString(); }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
Process.prototype.reportNewCostume = function (pixels, width, height) {
|
Process.prototype.reportNewCostume = function (pixels, width, height) {
|
||||||
// private
|
// private
|
||||||
width = Math.abs(Math.floor(+width));
|
width = Math.abs(Math.floor(+width));
|
||||||
|
|
Ładowanie…
Reference in New Issue