board editor code tweaks
This commit is contained in:
parent
7fb0d4e854
commit
d9279f4062
|
@ -1,21 +1,10 @@
|
|||
var k = Mousetrap;
|
||||
var m = require('mithril');
|
||||
|
||||
function preventing(f) {
|
||||
return function(e) {
|
||||
if (e.preventDefault) {
|
||||
e.preventDefault();
|
||||
} else {
|
||||
// internet explorer
|
||||
e.returnValue = false;
|
||||
}
|
||||
f();
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = function(ctrl) {
|
||||
k.bind('f', preventing(function() {
|
||||
k.bind('f', function(e) {
|
||||
e.preventDefault();
|
||||
ctrl.chessground.toggleOrientation();
|
||||
m.redraw();
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
|
|
@ -254,15 +254,12 @@ function sparePieces(ctrl, color, orientation, position) {
|
|||
|
||||
function onSelectSparePiece(ctrl, s, upEvent) {
|
||||
return function(e) {
|
||||
e.preventDefault();
|
||||
if (['pointer', 'trash'].includes(s)) {
|
||||
ctrl.selected(s);
|
||||
} else {
|
||||
ctrl.selected('pointer');
|
||||
|
||||
if (e.type === 'touchstart') {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
dragNewPiece(ctrl.chessground.state, {
|
||||
color: s[0],
|
||||
role: s[1]
|
||||
|
@ -292,8 +289,6 @@ function makeCursor(selected) {
|
|||
return 'url(' + url + '), default !important';
|
||||
}
|
||||
|
||||
var eventNames = ['mousedown', 'touchstart'];
|
||||
|
||||
module.exports = function(ctrl) {
|
||||
var fen = ctrl.computeFen();
|
||||
var color = ctrl.bottomColor();
|
||||
|
|
Loading…
Reference in a new issue