fix atomic UI explosions
This commit is contained in:
parent
88732e05b9
commit
a1d7c391cb
4
public/javascripts/vendor/chessground.min.js
vendored
4
public/javascripts/vendor/chessground.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@
|
|||
"watchify": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chessground": "1.8.4",
|
||||
"chessground": "1.8.6",
|
||||
"chessli.js": "file:../chessli",
|
||||
"game": "file:../game",
|
||||
"lodash-node": "^2.4.1",
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"watchify": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chessground": "1.8.4",
|
||||
"chessground": "1.8.6",
|
||||
"lodash-node": "^2.4.1",
|
||||
"mithril": "0.1.27"
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"watchify": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chessground": "1.8.4",
|
||||
"chessground": "1.8.6",
|
||||
"lodash-node": "^2.4.1",
|
||||
"mithril": "0.1.27"
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"watchify": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chessground": "1.8.4",
|
||||
"chessground": "1.8.6",
|
||||
"chessli.js": "file:../chessli",
|
||||
"lodash-node": "^2.4.1",
|
||||
"merge": "^1.2.0",
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"watchify": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chessground": "1.8.4",
|
||||
"chessground": "1.8.6",
|
||||
"chessli.js": "file:../chessli",
|
||||
"game": "file:../game",
|
||||
"lodash-node": "^2.4.1",
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
var util = require('chessground').util;
|
||||
|
||||
function capture(ctrl, key) {
|
||||
var ps = [];
|
||||
var pos = util.key2pos(key);
|
||||
var exploding = [];
|
||||
var diff = {};
|
||||
var orig = util.key2pos(key);
|
||||
for (var x = -1; x < 2; x++) {
|
||||
for (var y = -1; y < 2; y++) {
|
||||
var p = util.pos2key([pos[0] + x, pos[1] + y]);
|
||||
if (p) ps.push(p);
|
||||
var key = util.pos2key([orig[0] + x, orig[1] + y]);
|
||||
if (key) {
|
||||
exploding.push(key);
|
||||
if (ctrl.chessground.data.pieces[key] && ctrl.chessground.data.pieces[key].role !== 'pawn') diff[key] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctrl.chessground.explode(ps);
|
||||
ctrl.chessground.setPieces(diff);
|
||||
ctrl.chessground.explode(exploding);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in a new issue