kopia lustrzana https://github.com/backface/turtlestitch
added a %self menu
rodzic
6a65fa7c9c
commit
03acf231cd
|
@ -79,6 +79,7 @@
|
|||
|
||||
### 2019-05-08
|
||||
* Blocks, Objects, Threads: integrated video capture control into global settings prims in Sensing
|
||||
* Blocks, Threads: added a %self menu
|
||||
|
||||
### 2019-05-07
|
||||
* Blocks, Objects, Threads, Video: optimized video motion detection
|
||||
|
|
|
@ -1165,6 +1165,14 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
|
|||
true
|
||||
);
|
||||
break;
|
||||
case '%self':
|
||||
part = new InputSlotMorph(
|
||||
null,
|
||||
false,
|
||||
'objectsMenuWithSelf',
|
||||
true
|
||||
);
|
||||
break;
|
||||
case '%col': // collision detection
|
||||
part = new InputSlotMorph(
|
||||
null,
|
||||
|
@ -8889,12 +8897,19 @@ InputSlotMorph.prototype.clonablesMenu = function () {
|
|||
return dict;
|
||||
};
|
||||
|
||||
InputSlotMorph.prototype.objectsMenu = function () {
|
||||
InputSlotMorph.prototype.objectsMenuWithSelf = function () {
|
||||
return this.objectsMenu(true);
|
||||
};
|
||||
|
||||
InputSlotMorph.prototype.objectsMenu = function (includeMyself) {
|
||||
var rcvr = this.parentThatIsA(BlockMorph).scriptTarget(),
|
||||
stage = rcvr.parentThatIsA(StageMorph),
|
||||
dict = {},
|
||||
allNames = [];
|
||||
|
||||
if (includeMyself) {
|
||||
dict.myself = ['myself'];
|
||||
}
|
||||
dict[stage.name] = stage.name;
|
||||
stage.children.forEach(function (morph) {
|
||||
if (morph instanceof SpriteMorph && !morph.isTemporary) {
|
||||
|
|
|
@ -960,7 +960,8 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
reportObject: {
|
||||
type: 'reporter',
|
||||
category: 'sensing',
|
||||
spec: 'object %spr'
|
||||
spec: 'object %self',
|
||||
defaults: [['myself']]
|
||||
},
|
||||
reportURL: {
|
||||
type: 'reporter',
|
||||
|
|
|
@ -3418,15 +3418,17 @@ Process.prototype.getOtherObject = function (name, thisObj, stageObj) {
|
|||
// private, find the sprite indicated by the given name
|
||||
// either onstage or in the World's hand
|
||||
|
||||
// experimental: deal with first-class sprites
|
||||
// deal with first-class sprites
|
||||
if (isSnapObject(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
if (this.inputOption(name) === 'myself') {
|
||||
return thisObj;
|
||||
}
|
||||
var stage = isNil(stageObj) ?
|
||||
thisObj.parentThatIsA(StageMorph) : stageObj,
|
||||
thatObj = null;
|
||||
|
||||
if (stage) {
|
||||
// find the corresponding sprite on the stage
|
||||
thatObj = detect(
|
||||
|
|
Ładowanie…
Reference in New Issue