cm-chessboard

Example: Custom markers, left and right click, mark squares and log to console.


    board1.enableSquareSelect((event) => {
        console.log("SquareSelect board1", event)
        let markerType
        if(event.type === SQUARE_SELECT_TYPE.primary) {
            markerType = MARKER_TYPE.dot
        } else {
            markerType = MARKER_TYPE.circle
        }
        const markersOnSquare = board1.getMarkers(event.square, markerType)
        if (markersOnSquare.length > 0) {
            board1.removeMarkers(event.square, markerType)
        } else {
            board1.addMarker(event.square, markerType)
        }
    })