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