From df50c27042d59b5f0e8aeb8dd0e753d3ced5981a Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Thu, 30 Jan 2025 19:18:27 +0100 Subject: [PATCH] Improve documentation --- docs/Tools/README.md | 17 +++++++++++++++++ src/modules/tools/index.ts | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/docs/Tools/README.md b/docs/Tools/README.md index 372c3c2..b58d0d0 100644 --- a/docs/Tools/README.md +++ b/docs/Tools/README.md @@ -2,6 +2,23 @@ The Tools part allows you to let users draw elements on the map. +## Example + +```ts +// Change the settings for the line tool +felt.setToolSettings({ + tool: "line", + strokeWidth: 8, + color: "#448C2A" +}); + +// Start using the line tool +felt.setTool("line"); + +// Put down the tool +felt.setTool(null); +``` + ## Interfaces * [PinToolSettings](PinToolSettings.md) diff --git a/src/modules/tools/index.ts b/src/modules/tools/index.ts index 93b79f2..8d3c2de 100644 --- a/src/modules/tools/index.ts +++ b/src/modules/tools/index.ts @@ -1,6 +1,22 @@ /** * The Tools part allows you to let users draw elements on the map. * + * @example + * ```ts + * // Change the settings for the line tool + * felt.setToolSettings({ + * tool: "line", + * strokeWidth: 8, + * color: "#448C2A" + * }); + * + * // Start using the line tool + * felt.setTool("line"); + * + * // Put down the tool + * felt.setTool(null); + * ``` + * * @module Tools */ export type {