diff --git a/src/browser/jocly.xd-view.js b/src/browser/jocly.xd-view.js index 64829ba..aa698d8 100644 --- a/src/browser/jocly.xd-view.js +++ b/src/browser/jocly.xd-view.js @@ -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)); } diff --git a/src/core/jocly.core.js b/src/core/jocly.core.js index fede8c8..47c8114 100644 --- a/src/core/jocly.core.js +++ b/src/core/jocly.core.js @@ -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;