# chessboard-arrows

> A library that extends any chessboard interface to draw arrows and circles.

Latest version **1.0.2** (published 2020-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install chessboard-arrows
pnpm add chessboard-arrows
yarn add chessboard-arrows
bun add chessboard-arrows
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-04-07 |
| First published | 2020-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 98 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Brendon McBain |
| Maintainers | rey_pato |
| Keywords | chessboardjs, chessboard, arrows |

## Links

- npm: https://www.npmjs.com/package/chessboard-arrows
- Repository: https://github.com/mcba1n/chessboard-arrows
- Homepage: https://github.com/mcba1n/chessboard-arrows#readme
- Issues: https://github.com/mcba1n/chessboard-arrows/issues
- npm.io page: https://npm.io/package/chessboard-arrows

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-04-07
- 1.0.1 — 2020-04-07
- 1.0.0 — 2020-04-07

## README

# Chessboard Arrows
A library that extends any chessboard library to allow users to draw arrows and circles. It supports ES5 and TypeScript. The following setup will use [chessboard.js](https://github.com/oakmac/chessboardjs) for demonstration with the ES5 script.

![Example](example.PNG)

Right-click to draw arrows and circles, left-click to clear the drawings.

## Setup
Run the following npm command to install the package to `node_modules`.

```
npm i chessboard-arrows
```

chessboard-arrows is initialised by `var overlay = new ChessboardArrows(id[, resFactor, colour])`, where the following parameters are given as arguments:
  * `id`: the board wrapper ID.
  * `resFactor`: the ratio of the canvas size and board size. Increase this to get a higher DPI.
  * `colour`: the colour of the arrows and circles.

You can clear the canvas by calling `overlay.clearCanvas()`.


## Example

An example `index.html` is shown below to setup a project. It imports the javascript and stylesheet files for chessboard-arrows and chessboard.js. The initial board size is set to `400px`, with the canvas size 8 pixels less than this--this should be adjusted for your particular chessboard, ensuring the canvas perfectly overlays the chessboard.

```html
<html>
    <head>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.2/chess.js"></script>
        <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
        <link rel="stylesheet" href="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.css">
        <script src="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.js"></script>
        <link rel="stylesheet" href="chessboard-arrows.css">
        <script src="chessboard-arrows.js"></script>
    </head>
    <body>
        <div id="board_wrapper">
            <canvas id="primary_canvas" width="392" height="392" ></canvas>
            <canvas id="drawing_canvas"  width="392" height="392" ></canvas>
            <div id="board" style="width: 400px; height: 400px;"></div>
        </div>
    </body>
    <script>
        var board = Chessboard('board', 'start');
        var overlay = new ChessboardArrows('board_wrapper');
    </script>
</html>
```

---
_Source: https://npm.io/package/chessboard-arrows · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
