drag-start
The drag-start
event fires every time a piece is picked up.
HTML
<chess-board
style="width: 400px"
position="start"
draggable-pieces
spare-pieces>
</chess-board>
JavaScript
const board = document.querySelector('chess-board');
board.addEventListener('drag-start', (e) => {
const {source, piece, position, orientation} = e.detail;
console.log('Drag started:')
console.log('Source: ' + source)
console.log('Piece: ' + piece)
console.log('Position: ' + objToFen(position))
console.log('Orientation: ' + orientation)
console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
});