added "center" to drop-down options of location blocks

(GO TO, POINT TOWARDS, DISTANCE TO and DIRECTION TO)
upd4.2
jmoenig 2018-05-02 10:08:41 +02:00
rodzic 562ec48883
commit 1f4602844e
3 zmienionych plików z 20 dodań i 5 usunięć

Wyświetl plik

@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2018-April-16';
modules.blocks = '2018-May-02';
var SyntaxElementMorph;
var BlockMorph;
@ -8421,6 +8421,7 @@ InputSlotMorph.prototype.distancesMenu = function () {
dict['random position'] = ['random position'];
}
dict['mouse-pointer'] = ['mouse-pointer'];
dict['center'] = ['center'];
stage.children.forEach(function (morph) {
if (morph instanceof SpriteMorph && !morph.isTemporary) {

Wyświetl plik

@ -4096,3 +4096,7 @@ in development:
180427
------
* GUI: when creating a new sprite only randomize color and direction when shift-clicking
180502
------
* Blocks, Threads: added "center" to drop-down options of location blocks (GO TO, POINT TOWARDS, DISTANCE TO and DIRECTION TO)

Wyświetl plik

@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
TableFrameMorph, ColorSlotMorph, isSnapObject*/
modules.threads = '2018-April-12';
modules.threads = '2018-May-02';
var ThreadManager;
var Process;
@ -2900,9 +2900,11 @@ Process.prototype.doFaceTowards = function (name) {
thatObj;
if (thisObj) {
if (this.inputOption(name) === 'mouse-pointer') {
if (this.inputOption(name) === 'center') {
thisObj.faceToXY(0, 0);
} else if (this.inputOption(name) === 'mouse-pointer') {
thisObj.faceToXY(this.reportMouseX(), this.reportMouseY());
} if (this.inputOption(name) === 'random position') {
} else if (this.inputOption(name) === 'random position') {
thisObj.setHeading(this.reportRandom(1, 36000) / 100);
} else {
if (name instanceof List) {
@ -2929,7 +2931,9 @@ Process.prototype.doGotoObject = function (name) {
stage;
if (thisObj) {
if (this.inputOption(name) === 'mouse-pointer') {
if (this.inputOption(name) === 'center') {
thisObj.gotoXY(0, 0);
} else if (this.inputOption(name) === 'mouse-pointer') {
thisObj.gotoXY(this.reportMouseX(), this.reportMouseY());
} else if (this.inputOption(name) === 'random position') {
stage = thisObj.parentThatIsA(StageMorph);
@ -3127,6 +3131,9 @@ Process.prototype.reportDistanceTo = function (name) {
point = rc;
if (this.inputOption(name) === 'mouse-pointer') {
point = thisObj.world().hand.position();
} else if (this.inputOption(name) === 'center') {
return new Point(thisObj.xPosition(), thisObj.yPosition())
.distanceTo(new Point(0, 0));
} else if (name instanceof List) {
return new Point(thisObj.xPosition(), thisObj.yPosition())
.distanceTo(new Point(name.at(1), name.at(2)));
@ -3149,6 +3156,9 @@ Process.prototype.reportDirectionTo = function (name) {
if (this.inputOption(name) === 'mouse-pointer') {
return thisObj.angleToXY(this.reportMouseX(), this.reportMouseY());
}
if (this.inputOption(name) === 'center') {
return thisObj.angleToXY(0, 0);
}
if (name instanceof List) {
return thisObj.angleToXY(
name.at(1),