Skip to content

Commit

Permalink
Change the cursor to match the selected spare piece when hovering ove…
Browse files Browse the repository at this point in the history
…r the spare piece. Still need to make the same cursor appear when hovering over the board.
  • Loading branch information
BrandonE committed Feb 18, 2017
1 parent cf7eada commit 2f349fd
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 2 deletions.
Binary file added public/cursors/black-bishop.cur
Binary file not shown.
Binary file added public/cursors/black-king.cur
Binary file not shown.
Binary file added public/cursors/black-knight.cur
Binary file not shown.
Binary file added public/cursors/black-pawn.cur
Binary file not shown.
Binary file added public/cursors/black-queen.cur
Binary file not shown.
Binary file added public/cursors/black-rook.cur
Binary file not shown.
Binary file added public/cursors/trash.cur
Binary file not shown.
Binary file added public/cursors/white-bishop.cur
Binary file not shown.
Binary file added public/cursors/white-king.cur
Binary file not shown.
Binary file added public/cursors/white-knight.cur
Binary file not shown.
Binary file added public/cursors/white-pawn.cur
Binary file not shown.
Binary file added public/cursors/white-queen.cur
Binary file not shown.
Binary file added public/cursors/white-rook.cur
Binary file not shown.
1 change: 0 additions & 1 deletion public/stylesheets/boardEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ body.dark #board_editor .spare.white {
height: 58.102px;
}
#board_editor .spare piece {
cursor: pointer;
width: 100%;
height: 100%;
}
Expand Down
8 changes: 7 additions & 1 deletion ui/editor/src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,14 @@ function sparePieces(ctrl, color, orientation, position) {
class: ['spare', position, 'orientation-' + orientation, color].join(' ')
}, ['pointer', 'king', 'queen', 'rook', 'bishop', 'knight', 'pawn', 'trash'].map(function(role) {
var piece = ((['pointer', 'trash'].indexOf(role) === -1) ? color + ' ' : '') + role,
selectedParts = ctrl.vm.selected().split(' '),
cursorName = selectedParts[0] + ((selectedParts.length >= 2) ? '-' + selectedParts[1] : ''),
cursor = (cursorName === 'pointer') ?
// http://www.cursors-4u.com
cursorName : 'url(/assets/cursors/' + cursorName + '.cur), default !important',
pieceElement = {
class: piece
class: piece,
style: 'cursor: ' + cursor
},
containerClass = 'no-square' + ((ctrl.vm.selected() === piece) ? ' selected-square' : '');

Expand Down

0 comments on commit 2f349fd

Please sign in to comment.