added experimental reset view method

This commit is contained in:
mig 2017-04-20 14:48:57 +02:00
parent 1534df6051
commit 2239a730e8
2 changed files with 23 additions and 0 deletions

View file

@ -2719,6 +2719,11 @@ if(window.JoclyXdViewCleanup)
};
resolve();
break;
case "stopAnimations":
var animCount = TWEEN.getAll().length;
TWEEN.removeAll();
resolve(animCount>0);
break;
default:
reject(new Error("ViewControl: unsupported command "+cmd));
}

View file

@ -970,6 +970,24 @@
return ProxiedMethod(this, "getPossibleMoves", arguments);
}
// experimental
GameProxy.prototype.resetView = function () {
if (jsContext == "node")
return Promise.reject(new Error("resetView(): not supported in node.js"));
if (!this.area && !this.iframe)
return Promise.reject(new Error("resetView(): match is not attached to DOM element"));
if (this.game) {
var self = this;
return self.viewControl("stopAnimations")
.then((shouldRedisplayBoard) => {
if(shouldRedisplayBoard)
self.game.DisplayBoard();
})
} else
return ProxiedMethod(this, "resetView");
}
exports._createInternalGame = CreateInternalGame; // do not use this
exports.PLAYER_A = 1;