stop using deprecated chessground capture event

This commit is contained in:
Thibault Duplessis 2015-03-19 11:30:47 +01:00
parent 553c07d0d6
commit 79ab5d9609
3 changed files with 11 additions and 7 deletions

View file

@ -30,7 +30,9 @@ function makeConfig(data, situation, onMove) {
duration: data.pref.animationDuration
},
events: {
capture: $.sound.take
move: function(orig, dest, captured) {
if (captured) $.sound.take();
}
},
disableContextMenu: true
};

View file

@ -58,12 +58,14 @@ module.exports = function(opts) {
$.sound.move(this.data.player.color == 'white');
}.bind(this);
var onCapture = function(key) {
if (this.data.game.variant.key === 'atomic') atomic.capture(this, key);
else $.sound.take();
var onMove = function(orig, dest, captured) {
if (captured) {
if (this.data.game.variant.key === 'atomic') atomic.capture(this, dest, captured);
else $.sound.take();
}
}.bind(this);
this.chessground = ground.make(this.data, opts.data.game.fen, onUserMove, onCapture);
this.chessground = ground.make(this.data, opts.data.game.fen, onUserMove, onMove);
this.apiMove = function(o) {
m.startComputation();

View file

@ -46,13 +46,13 @@ function makeConfig(data, fen, flip) {
};
}
function make(data, fen, userMove, onCapture) {
function make(data, fen, userMove, onMove) {
var config = makeConfig(data, fen);
config.movable.events = {
after: userMove
};
config.events = {
capture: onCapture
move: onMove
};
config.viewOnly = data.player.spectator;
return new chessground.controller(config);