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
|
||||
* Objects, Threads: let "getImageAttribute" deal with null costumes
|
||||
* 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
|
||||
* Blocks, Objects, Threads: new "getSoundAttribute" reporter primitive
|
||||
|
|
|
@ -8918,6 +8918,7 @@ InputSlotMorph.prototype.costumesMenu = function () {
|
|||
} else { // stage
|
||||
dict = {Empty : ['Empty']};
|
||||
}
|
||||
dict.current = ['current'];
|
||||
rcvr.costumes.asArray().forEach(function (costume) {
|
||||
allNames = allNames.concat(costume.name);
|
||||
});
|
||||
|
|
|
@ -3294,6 +3294,9 @@ SpriteMorph.prototype.doSwitchToCostume = function (id, noShadow) {
|
|||
this.wearCostume(id, noShadow);
|
||||
return;
|
||||
}
|
||||
if (id instanceof Array && (id[0] === 'current')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var num,
|
||||
arr = this.costumes.asArray(),
|
||||
|
|
|
@ -4338,14 +4338,7 @@ Process.prototype.doSetInstrument = function (num) {
|
|||
// Process image processing primitives
|
||||
|
||||
Process.prototype.reportGetImageAttribute = function (choice, 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(); }
|
||||
)
|
||||
) || new Costume(),
|
||||
var cst = this.costumeNamed(name) || new Costume(),
|
||||
option = this.inputOption(choice);
|
||||
|
||||
switch (option) {
|
||||
|
@ -4363,18 +4356,11 @@ Process.prototype.reportGetImageAttribute = function (choice, name) {
|
|||
};
|
||||
|
||||
Process.prototype.reportNewCostumeStretched = function (name, xP, yP) {
|
||||
var cst;
|
||||
if (name instanceof List) {
|
||||
return this.reportNewCostume(name, xP, yP);
|
||||
}
|
||||
|
||||
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(); }
|
||||
)
|
||||
);
|
||||
cst = this.costumeNamed(name);
|
||||
if (!cst) {
|
||||
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) {
|
||||
// private
|
||||
width = Math.abs(Math.floor(+width));
|
||||
|
|
Ładowanie…
Reference in New Issue