added swapMeshes method to swap textures of 2 meshes

This commit is contained in:
logsol 2015-05-06 20:13:13 +02:00
parent 1db8de34df
commit ec7ce459cb
3 changed files with 25 additions and 2 deletions

View file

@ -103,6 +103,22 @@ function (Parent, PIXI, ColorRangeReplaceFilter, Settings, ColorConverter, Nc) {
this.container.setChildIndex(meshB, indexA);
};
Layer.prototype.swapMeshes = function(meshA, meshB) {
var textureA = meshA.texture;
var textureB = meshB.texture;
meshA.setTexture(textureB);
meshA.onTextureUpdate();
meshA.scale.x = 1;
meshA.scale.y = 1;
meshB.setTexture(textureA);
meshB.onTextureUpdate();
meshB.scale.x = 1;
meshB.scale.y = 1;
};
Layer.prototype.createMesh = function (texturePath, callback, options) {
var texture = (options && options.fromFrame)