stop using deprecated chessground capture event
This commit is contained in:
parent
553c07d0d6
commit
79ab5d9609
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue