compress pieces in crowded crazyhouse pocket

This commit is contained in:
Thibault Duplessis 2016-01-20 23:23:02 +07:00
parent c5faeb32a5
commit e04e16405a
3 changed files with 10 additions and 4 deletions

View file

@ -599,6 +599,7 @@ div.table {
background: #888;
white-space: nowrap;
max-width: 244px;
overflow: hidden;
}
.pocket.top {
margin-bottom: 10px;
@ -613,9 +614,12 @@ div.table {
position: relative;
}
.pocket piece:first-child {
margin-left: 0;
border-radius: 3px 0 0 3px;
}
.pocket.crowded piece {
width: 48.5px!important;
background-position: center;
}
.pocket.usable piece {
cursor: pointer;
transition: background-color 0.13s;

View file

@ -10,9 +10,10 @@ module.exports = {
if (!step.crazy) return;
var pocket = step.crazy.pockets[color === 'white' ? 0 : 1];
var oKeys = Object.keys(pocket)
var crowded = oKeys.length > 4;
var usable = color === ctrl.chessground.data.movable.color;
return m('div', {
class: 'pocket is2d ' + position + (usable ? ' usable' : ''),
class: 'pocket is2d ' + position + (usable ? ' usable' : '') + (crowded ? ' crowded' : ''),
config: function(el, isUpdate, context) {
if (isUpdate) return;
var onstart = partial(crazyDrag, ctrl, color);

View file

@ -11,10 +11,11 @@ module.exports = {
var step = round.plyStep(ctrl.data, ctrl.vm.ply);
if (!step.crazy) return;
var pocket = step.crazy.pockets[color === 'white' ? 0 : 1];
var oKeys = Object.keys(pocket)
var oKeys = Object.keys(pocket);
var crowded = oKeys.length > 4;
var usable = position === 'bottom' && !ctrl.replaying() && game.isPlayerPlaying(ctrl.data);
return m('div', {
class: 'pocket is2d ' + position + (usable ? ' usable' : ''),
class: 'pocket is2d ' + position + (usable ? ' usable' : '') + (crowded ? ' crowded' : ''),
config: position === 'bottom' ? function(el, isUpdate, context) {
if (isUpdate) return;
var onstart = partial(crazyDrag, ctrl);