kopia lustrzana https://github.com/backface/turtlestitch
Merge pull request #1390 from brollb/1207-go-back-layers
'go to back' on large num in 'go back' block. Fixes #1207pull/29/head
commit
ce5561faa8
|
@ -3201,12 +3201,15 @@ SpriteMorph.prototype.comeToFront = function () {
|
|||
};
|
||||
|
||||
SpriteMorph.prototype.goBack = function (layers) {
|
||||
var layer, newLayer = +layers || 0;
|
||||
var layer,
|
||||
newLayer = +layers,
|
||||
targetLayer;
|
||||
|
||||
if (!this.parent) {return null; }
|
||||
layer = this.parent.children.indexOf(this);
|
||||
if (layer < newLayer) {return null; }
|
||||
this.parent.removeChild(this);
|
||||
this.parent.children.splice(layer - newLayer, null, this);
|
||||
targetLayer = Math.max(layer - newLayer, 0);
|
||||
this.parent.children.splice(targetLayer, null, this);
|
||||
this.parent.changed();
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue